Date: Mon, 19 Mar 2001 12:00:14 -0600 From: Lucas Bergman <lucas@slb.to> To: Christopher Leigh <clcont@gmx.net> Cc: freebsd-questions@freebsd.org Subject: Re: uhm. why isn't there a vigr for freebsd? Message-ID: <20010319120014.A3274@billygoat.slb.to> In-Reply-To: <000f01c0b02f$191482e0$fa87a7d8@king1>; from clcont@gmx.net on Sun, Mar 18, 2001 at 10:43:07PM -0600 References: <200103190333.f2J3XDe33615@grumpy.dyndns.org> <000f01c0b02f$191482e0$fa87a7d8@king1>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010319120014.A3274>