Date: Mon, 10 Feb 2003 03:40:34 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: abc@anchorageinternet.org Cc: freebsd-questions <questions@FreeBSD.ORG> Subject: Re: #!/bin/sh & execve Message-ID: <20030210014034.GA91205@gothmog.gr> In-Reply-To: <200302100118.h1A1I3bm021762@en26.groggy.anc.acsalaska.net> References: <200302100118.h1A1I3bm021762@en26.groggy.anc.acsalaska.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Please don't remove me from the Cc: list when you reply to posts that you want me to see. Otherwise, I might miss one of your replies and give you the false impression that I'm somehow ignoring your posts. On 2003-02-10 01:18, abc@anchorageinternet.org wrote: > Giorgos Keramidas wrote: > > abc@anchorageinternet.org wrote: > > > it seems more sane to allow arguments to a script given to an > > > interpreter on the shebang line, passing everything after > > > "#!/interpreter [arg]" off for "eval" or "sh -c" type parsing. > > > > This is something that can be bth good and bad though. As you have > > pointed out, if a limited sort of parsing is allowed, then it would > > most likely have to be sh(1)-like. This means that the mechanism that > > inteprets '#!' would have to know all the intricacies of the sh(1) > > parser to work correctly in all cases. Incomplete sh(1)-like parsers > > that would understand "most of the sh(1) shell syntax" would be > > exactly that... incomplete. > > the method used by FBSD 2.2.7 seems the most sane to me, > where execve's argv[] is loaded by each whitespace > seperated element after the shebang, > then by command line options. > > 1. it is flexible. > 2. it functions intuitively. > 3. i don't think it breaks less flexible methods. It also suffers from problems with arguments that are meant to include spaces, like: #!/bin/sh "hello world" "foo bar" Without a fully functional sh(1)-like parser, any solution that does magic with argv[] is incomplete :-( To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030210014034.GA91205>