On Mon, May 07, 2007 at 11:04:02PM +0200, Sjoerd Hiemstra wrote: > Manon Metten wrote: > > BTW: what's the first line "#!/bin/bash" in the script for? > > It is not really necessary, but it has some advantages. > The 'file' command will recognize the file as a script, there are > certain other programs (emacs?) that will treat it as such.... and > here is where my limited knowledge ends. > I'm sure others could say more about it. >
it ensures script compatibility across different systems. There is no guarantee that the default shell on a system will be bash, so this specifies to the shell interpreter to use bash instead of the default shell. It could just as easily be some other shell: csh, ksh, plain sh, or whatever. Its likely not necessary for something as simple as launching a program, but if you start using shell features such as expansion and expressions, its s good idea to do this just in case. there is another way to do it that escapes me now that is even more compatible across environments.... maybe someone will fill us in. A
signature.asc
Description: Digital signature