| Aslak Johansen 2005-02-18, 2:48 am |
| On Fri, 2005-02-18 at 07:46 +0100, Matt Benson wrote:
> Imagine I have the three shells csh, ksh and bash.
> Currently I am working under shell a and call from the command line
> a script with shebang "#!/bin/b" by shell c
>
> e.g.:
>
> csh>ksh myscript.sh
>
> where myscript.sh starts
>
> #!/usr/local/bin/bash
>
> By which shell/script interpreter is the script executed?
myscript.sh is executed under ksh. csh is simply your working
environment. The shebang line is used if executed directly:
./myscript.sh
when executing through ksh
ksh myscript.sh
The shebang line is skipped (# comments out the remainder of the line in
most shells), executing the script as if written in ksh. However, the
shebang indicates that the script is probably written in bash. Therefore
you might get trouble if the syntax between ksh and bash does not match.
-aslak
|