From owner-freebsd-questions Mon Mar 19 13:21:58 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dsl-64-193-218-89.telocity.com (dsl-64-193-218-89.telocity.com [64.193.218.89]) by hub.freebsd.org (Postfix) with SMTP id 0866737B72F for ; Mon, 19 Mar 2001 13:21:53 -0800 (PST) (envelope-from lucas@slb.to) Received: (qmail 17910 invoked by uid 1000); 19 Mar 2001 18:00:15 -0000 Date: Mon, 19 Mar 2001 12:00:14 -0600 From: Lucas Bergman To: Christopher Leigh Cc: freebsd-questions@freebsd.org Subject: Re: uhm. why isn't there a vigr for freebsd? Message-ID: <20010319120014.A3274@billygoat.slb.to> Reply-To: lucas@slb.to References: <200103190333.f2J3XDe33615@grumpy.dyndns.org> <000f01c0b02f$191482e0$fa87a7d8@king1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <000f01c0b02f$191482e0$fa87a7d8@king1>; from clcont@gmx.net on Sun, Mar 18, 2001 at 10:43:07PM -0600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > i still like typing vigr. (linux spoils me...) Whatever. > i guess > > #!/bin/sh > vi /etc/group > > will have to suffice. :) > > any security concerns in doing that? Good enough. No security problems unless the script is setuid, setgid, or something like that. > could i do > > #!/bin/sh > exec vi /etc/group Yes. > what's the difference? The second method saves one process. In the first example, you have (1) /bin/sh process (say, x) starts, taking commands from your script (2) process x starts a new process y, which runs 'vi' (3) when you're done editing, process y exits (4) process x looks for more commands, hits end of file, so process x exits In the second example, you have (1) /bin/sh process (say, x) starts, taking commands from your script (2) process x runs 'vi' (no new process is created) (3) when you're done editing, process x exits To use some lingo, using the 'exec' shell builtin means the current shell's process is *replaced* with the command that follows. Clearly, this implies no further commands in the script get executed after an 'exec' is run. See this by running #! /bin/sh exec echo first echo second > ty. yw. Lucas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message