[Techtalk] probably a stupid scripting question
Adam Williamson
awilliam at redhat.com
Sun Nov 8 07:23:24 UTC 2009
On Sun, 2009-11-08 at 16:25 +1000, Miriam English wrote:
> Can anybody give me a simple explanation of what exec does? Am I right
> that the exec'ed command takes over current process and if that process
> is (was) a script, then the script is no longer executing?
> If so, what use is that? I notice a lot of application icon scripts use
> exec. Why not use "&" at the end of a command instead? That way the
> script could do other things and end leaving the command to continue on
> its merry way.
AIUI - and, bear in mind, I could be utterly wrong - it's mainly for use
in things like wrapper scripts. Say you want to write a script to do a
bunch of preparation, then finally run Firefox. If you end it with 'exec
firefox', then you don't have the wrapper script hanging around forever
while Firefox is running; the wrapper script does its stuff, runs
Firefox, and then all you have is a Firefox process.
But, uh, don't quote me :)
(hey, Google supports me:
http://www.freebsd.org/doc/en/books/porters-handbook/dads-sh-exec.html)
--
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Fedora Talk: adamwill AT fedoraproject DOT org
http://www.happyassassin.net
More information about the Techtalk
mailing list