Using #! /bin/sh in Shell scripts

Hi All,

What does #! /bin/sh mean in a shell script? Is it mandatory to include in a shell script? I'm able to execute the shell script without it.

Any help on this would be appreciated.

it actually tells the script to which interpreter to refer. As you know, bash shell has some specific functions that other shell does not have and vice-versa. Same way is for perl, python and other languages.

Thanks for the info. I still have doubts. If this information is not provided, how the path of the interpreter is assumed?

Do people ever read the FAQ's or even use the search feature ? :frowning:

See http://www.unix.com/showthread.php?t=7077

Right. You should do what vino says before asking. Anyway, If you don't specify that information, the user's default shell will be used.