06-13-2012, 07:31 AM
|
#2
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
For the most part commands are forked from the shell. You can even start a new shell which is forked from the original. When the command completes or exits it returns to the original shell.
You can use "exec <command>" to exec a command rather than fork it. However since the exec tells the command to replace the original process (the shell) it means once the command completes it will exit the system. This is sometimes desirable if say you've created a login specifically for the purpose of launching a command and don't want users to access the shell directly. (In such a case you also have to disable traps to insure the user can't hit ctrl-c or some other break/exit keystroke combination fast enough to get to shell prompt before the exec runs.)
|
|
1 members found this post helpful.
|