.TH eval "" "" Command
.PC "Evaluate arguments"
\fBeval\fR [\fItoken ...\fR]
.PP
.HS
The shell executes \fBeval\fR directly.
.HE
The shell
normally evaluates each token of an input line before executing it.
During evaluation, the shell performs parameter, command, and
file-name pattern substitution.
The shell does
.I not
interpret special characters after performing substitution.
.PP
.B eval
is useful when an additional level of evaluation is required.
It evaluates its arguments and treats the result as shell input.
For example,
.DM
	A='>file'
	echo a b c $A
.DE
.PP
simply prints the output
.DM
	a b c >file
.DE
.PP
because \*(Ql>\*(Qr has no special meaning after substitution, but
.DM
	A='>file'
.br
	eval echo a b c $A
.DE
.PP
redirects the output
.DM
	a b c
.DE
.PP
to
.BR file .
Similarly,
.DM
	A='$B'
	B='string'
	echo $A
	eval echo $A
.DE
.PP
prints
.DM
	$B
	string
.DE
.PP
In the first
.B echo
the shell performs substitution only once.
.PP
The shell executes
.B eval
directly.
.SH "See Also"
.Xr "commands," commands
.Xr "ksh," ksh
.Xr "sh" sh
