EXEC(1SH) COMMAND REFERENCE EXEC(1SH) NAME exec - executes arguments without creating a new process (sh built-in) SYNOPSIS exec [ arg . . . ] DESCRIPTION The command specified by arg, is executed in place of this shell without creating a new process. Input/output arguments may appear and, if no other arguments are given, cause the shell input/output to be modified. The builtin sh command login is equivalent to the command exec login ... EXAMPLES The system has a limit on the number of processes that can exist at any time and a limit on the number of active processes for each user (typically 20). The average user will very rarely reach this limit, but sometimes a number of processes will get caught in infinite loops or run for a long time. When this happens, the user can not kill any of the processes because one process slot is required to execute kill. In this situation, the command: exec kill -9 0 will kill all processes currently running. Of course, this means that the user must log in again, but as stated before, this happens very rarely. The following shell script fragment uses exec with no arguments to internally redirect the standard output. #!/bin/sh if test \( $# -ge 2 \) -a \( "x$1" = "x-f" \) then exec > "$2" shift shift fi other commands ... RETURN VALUE Exec returns the exit status of the command executed. If the command does not exist, the exit code will be NOCMD. SEE ALSO break(1sh), cd(1sh), chdir(1sh), continue(1sh), csh(1csh), Printed 4/6/89 1
EXEC(1SH) COMMAND REFERENCE EXEC(1SH) echo(1sh), eval(1sh), exec(1csh), exit(1sh), export(1sh), hash(1sh), login(1), pwd(1sh), read(1sh), readonly(1sh), return(1sh), set(1sh), sh(1sh), shift(1sh), test(1sh), times(1sh), trap(1sh), type(1sh), ulimit(1sh), umask(1sh), unset(1sh), wait(1sh), which(1sh), and execve(2). Printed 4/6/89 2
%%index%% na:288,131; sy:419,161; de:580,622; ex:1202,1185; rv:2387,359; se:2746,221;3327,709; %%index%%000000000118