[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Stupid shebang tricks & env -



On Thursday 12 May 2005 20:43, Adeodato Simó wrote:
> * Wesley J. Landaker [Thu, 12 May 2005 20:41:17 -0600]:
> > On Thursday 12 May 2005 20:18, Adeodato Simó wrote:
> > >   Uhm, nice (one fork less), but then you can "quote arguments" (and
> > >   "$*" won't help here).
> >
> > But "$@" will.
>
>   No, sorry, it won't (I tested this stuff). At least in my system, the
>   kernel will pass, for a she-bang like:
>
>     #!/foo bar "baz quux"
>
>   the string 'bar "baz quux"' as $1. To break that into parts, you need
>   exactly "$*".

You're absolutely right, I misread what the OP was trying to do. =) 

In that case, the sh -c trick is certainly better than the exec. (One of my 
pet peeves is scripts and programs that don't work with filenames that have 
spaces and shell characters in them.)

-- 
Wesley J. Landaker <wjl@icecavern.net>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2

Attachment: pgpmzKnauJJKj.pgp
Description: PGP signature


Reply to: