NetBSD-Bugs archive

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

Re: bin/45430: ash uses argv[0] as $0 for scripts without #!



The following reply was made to PR bin/45430; it has been noted by GNATS.

From: Nikolai Kondrashov <spbnick%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: David Holland <dholland-bugs%netbsd.org@localhost>, 
gnats-admin%netbsd.org@localhost, 
 netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/45430: ash uses argv[0] as $0 for scripts without #!
Date: Mon, 07 Nov 2011 00:15:51 +0200

 On 11/06/2011 02:50 AM, David Holland wrote:
 >   better way to do that:
 >
 >   XYZZY=--; exec lua $(type "$0" | cut -d' ' -f3) "$@"
 >
 >   Here at least lua accepts "XYZZY=" with no value, but you can also do
 >
 >   XYZZY="zzyzx"--; exec lua $(type "$0" | cut -d' ' -f3) "$@"
 
 Still slightly better way to do this, combined with the "command" solution:
 
 _=_--; exec lua "`command -v \"\$0\"`" "\$@"
 
 I think I'm going to stop on this one and maybe revert the sh fix I did in
 our branch to keep merges simpler.
 
 Thanks for all the help, no matter the disagreement :)
 
 Sincerely,
 Nick
 


Home | Main Index | Thread Index | Old Index