Zsh Mailing List Archive
Messages sorted by:
Re: How do I change the subshell to something other than /bin/sh?
- X-seq: zsh-users 11928
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: How do I change the subshell to something other than /bin/sh?
- Date: Thu, 4 Oct 2007 19:04:17 +0100
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <200710041645.l94Gj7Db016515@xxxxxxxxxxxxxx>
- Mail-followup-to: Peter Stephenson <pws@xxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <BAY142-F32351B72FA90C8C20D323EA3A80@xxxxxxx> <200710041645.l94Gj7Db016515@xxxxxxxxxxxxxx>
On Thu, Oct 04, 2007 at 05:45:07PM +0100, Peter Stephenson wrote:
> "Julio Garcia" wrote:
> > My problem is this. I am trying to run some scripts that I cannot change
> > which assume capabilities found in bash. I know that zsh will execute them
> > correctly as well. However, when I just invoke them from the zsh command
> > line, they run under /bin/sh and fail. For example, I have a test script
> > that looks like this:
> > logsol10-1 ~ > cat x.sh
> > echo $0
> > ps
> If you really can't change the script (and hence can't add a #! line),
> you are stuck with running "zsh ./x.sh" wherever you call the script, or
> some equivalent of that. The decision about which interpreter to run
> for a file that isn't executable is made by the operating system, so
> the's no way of changing it at the user level. So the question is
> really about how you're calling the script and how much you can change
> at that point.
On most system, the execve() of a script that doesn't have a #!
line will return with ENOEXEC. In which case, it will be zsh
that will run /bin/sh (if it doesn't find a NUL character in the
first 64 bytes of the file).
That's also what the exec*p() type libc functions do, except that
those may not run /bin/sh but whichever shell is required by the
standard they implement and don't search for NUL bytes.
Maybe in sh emulation, zsh could call itself in sh emulation in
Messages sorted by: