Oops, it seems I sent an incomplete mail. Sorry for that.

> Why do a lot of bash scripts start with the first line as #!/bin/bash

  It means that the script must be executed by the program #!/bin/bash.
                                                       
> They seem to work just as well without.

  Not if you were using another shell than bash, like csh or tcsh, which uses
different syntax. Try the following :

==============================================================================
bash# cat > tmpscript 
# 
export TOTO='hello world'
echo $TOTO
bash# chmod +x ./tmpscript 
bash# tmpscript 
hello world
bash# csh
csh% tmpscript
export: Command not found.
TOTO: Undefined variable.
==============================================================================

  csh did not run the script right. Now, try :
==============================================================================
bash# cat > tmpscript 
#!/bin/bash
export TOTO='hello world'
echo $TOTO
bash# tmpscript 
hello world
bash# csh
csh% tmpscript
hello world
==============================================================================

 Cheers,

  Etienne

Reply via email to