Sunday, June 29, 2008

The shebang line



The majority of shell scripts use shebang line (#!) at the beginning to control the type of the shellused to run the script;this bang line calls for an incantation of the bash:

#!/bin/sh

using a shebang line is common practice for all shell scripting.

ex:- if you want to write a shell script using bash,but want the script to execute as if run by the bourne shell sh,the first line of your script will contain #!/bin/sh, which is a link to the bash shell


the shebang line is a magic number, as defined in /usr/share/magic, a text database of magic numbers for the linux file command. magic numbers are used by many different linux commands to quickly identify the type of a file

see:- man 5 magic

No comments:

Post a Comment