Unix questions - Re: Which shell interpreter has priority: The declared, the current

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > February 2005 > Re: Which shell interpreter has priority: The declared, the current





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Which shell interpreter has priority: The declared, the current
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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com