Execute Shell file in linux server

chmod Command: Run Shell Script In Linux

Set an executable permission using the chmod command as follows:

[code]chmod +x file.sh[/code]

Now your can run your .sh file as follows:

Execute Shell Script Using . ./ (dot space dot slash)

[code]./file.sh[/code]

You can also execute a unix shell script by specifying the interpreter in the command line as shown below.
Execute using sh interpreter

[code]$ sh scriptfile[/code]

Execute using bash interpreter

[code]$ bash scriptfile[/code]

Permanent link to this article: https://blog.openshell.in/2013/03/execute-shell-file-in-linux-server/

Leave a Reply

Your email address will not be published.