Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh portable script



On Monday 12 July 2010 18:18:52 Vincent Lefevre wrote:
> On 2010-07-12 18:15:19 +0200, Vincent Lefevre wrote:
> > On 2010-07-12 17:45:18 +0200, Joke de Buhr wrote:
> > > sorry, the correct version should be:
> > >   #!/bin/sh
> > >   
> > >   if [ -z "$ZSH_VERSION" ]; then
> > >   
> > >       ## searching PATH for zsh executable
> > >       exec zsh $0 $*
> > 
> > As arguments may contain spaces, this is incorrect. This should be:
> >   exec zsh "$0" ${1+"$@"}
> 
> Sorry,
> 
>   exec zsh -- "$0" ${1+"$@"}
> 
> as I said in my previous reply.

Just for the fun of it. An executable file without the #! line is correct 
either. So just write:

---------------------- file ----------------------
[ -z "$ZSH_VERSION" ] && exec zsh -- "$0" ${1+"$@"}
print "hello from zsh"
--------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part.



Messages sorted by: Reverse Date, Date, Thread, Author