.TH exec "" "" Command
.PC "Execute command directly"
\fBexec\fR [\fIcommand\^\fR]
.PP
.HS
The shell executes \fIcommand\fR by one of the
\fBexec()\fR functions rather than through the system call \fBfork()\fR.
This normally terminates the current shell.
Current shell I/O may be redirected by \fBexec\fR with no \fIcommand\fR.
.HE
The shell normally executes commands through the system call
.BR fork() ,
which creates a new process.
The shell command
.B exec
directly executes the given
.I command
through one of the
.B exec()
functions instead.
Normally, this terminates execution of the current shell.
.PP
If the
.I command
consists only of redirection specifications,
.B exec
redirects the input or output of the current shell accordingly
without terminating it.
If the
.I command
is omitted,
.B exec
has no effect.
.SH "See Also"
.Xr "commands," commands
.Xr "execution," execution
.Xr "fork()," fork
.Xr "ksh," ksh
.Xr "sh," sh
.Xr "xargs" xargs
.br
\*(PX Standard, \(sc3.1.2
