From owner-freebsd-questions Sun Feb 9 17:40:49 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3775237B401 for ; Sun, 9 Feb 2003 17:40:48 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4125F43F75 for ; Sun, 9 Feb 2003 17:40:46 -0800 (PST) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-a022.otenet.gr [212.205.215.22]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id h1A1eaRX017040; Mon, 10 Feb 2003 03:40:37 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.6/8.12.6) with ESMTP id h1A1eZdk065250; Mon, 10 Feb 2003 03:40:35 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.6/8.12.6/Submit) id h1A1eY7B065117; Mon, 10 Feb 2003 03:40:34 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 10 Feb 2003 03:40:34 +0200 From: Giorgos Keramidas To: abc@anchorageinternet.org Cc: freebsd-questions Subject: Re: #!/bin/sh & execve Message-ID: <20030210014034.GA91205@gothmog.gr> References: <200302100118.h1A1I3bm021762@en26.groggy.anc.acsalaska.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200302100118.h1A1I3bm021762@en26.groggy.anc.acsalaska.net> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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