Saturday 5 November 2016

What are the 4 ways of executing a shell script in Unix/Linux?

Q. 73. What are the 4 ways of executing a shell script in Unix/Linux?

1 - Use the filename to run the shell script 
$ /home/pbmac/scripts/myscript   (myscript is the file name)
2 - Specify the interpreter as a way to execute the shell script   
$ bash myscript    (bash is the interpreter)
3 - Using . ./ (dot space dot slash) to execute the shell script 
$ . ./myscript
4 - Using the source command to execute the shell script 

$ source ./myscript

No comments:

Post a Comment

Tricks and Tips