Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: #!/path/to/arch-indep/zsh -f
- X-seq: zsh-workers 8005
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: "Owen M. Astley" <oma1000@xxxxxxxxx>
- Subject: Re: #!/path/to/arch-indep/zsh -f
- Date: Wed, 22 Sep 1999 16:28:27 +0000
- Cc: zsh-workers@xxxxxxxxxxxxxx
- In-reply-to: <Pine.OSF.3.96.990922122005.5737A-100000@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <Pine.OSF.3.96.990922122005.5737A-100000@xxxxxxxxxxxxxxxxxx>
On Sep 22, 12:24pm, Owen M. Astley wrote:
} Subject: Re: #!/path/to/arch-indep/zsh -f
}
} > Most (I don't know if I can say "all") operating systems won't do two
} > levels of indirection via #! lines. That is, if the thing on the #!
} > line is not itself a binary in executable format, the OS will not
} > recognize yet another #! line and launch still another interpreter.
}
} $ <test.sh
} #!/u/pol1b/oma1000/bin/zsh
}
} echo f
} $ head -n 1 /u/pol1b/oma1000/bin/zsh
} #!/bin/sh -
} $ ./test.sh
} f
} $ reportzsh
} zsh-3.0.6 dec-alpha-osf4.0
}
} So not on this system.
I can't decide if you're agreeing with me or giving a counterexample.
} I thought that most (all) modern operating systems recognise #!
} as a magic number in exec()?
They do, but not necessarily recursively. Remember that the semantics
of the #! line are to take the name of the interpreter from the line
and run it with the name of the file as its first argument. If the
interpreter is itself a script with a #!, that would add yet another
first argument, and so on. The original script file might never have
its contents evaluated at all -- which could be interpreted (sorry) as
a security problem.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author