had ever Imagined whats #!/bin/sh in your Shell Script??
You may have seen this many times in lot of scripts.
But question is that does it have any role in script?
In Linux/Unix System we combine many Terminal commands in single file,called as shell Script. It runs all commands Step by Step up to EOF(End of File).Whenever we want to run this script we use command as “sh /scriptpath/script.sh”
So now each time you want to run script we will issue above command .To avoid this we just add a line at Start of of file which describes path to the interpreter in this case /bin/sh and is written in manner(Its called as Shebang line):
note: don’t confuse between sh,bash,ksh,ash…..
you can google difference between them and decide which one to use…..
1)Write a script
2) add a line at top of file :
3)Make your script executable:
sudo chmod +x /path/to/script
4)Now you can directly run script by only issuing script name.