|
|
coherent
eval Command eval
Evaluate arguments
eevvaall [_t_o_k_e_n ...]
The shell sh normally evaluates each token of an input line
before executing it. During evaluation, the shell performs
parameter, command, and file name pattern substitution, as
described in sh. The shell does not interpret special characters
after performing substitution.
eval is useful when an additional level of evaluation is re-
quired. eval evaluates its arguments and treats the result as
shell input. For example,
A='>file'
echo a b c $A
simply prints the output
a b c >file
because `>' has no special meaning after substitution, but
A='>file'
eval echo a b c $A
redirects the output
a b c
to file. Similarly,
A='$B'
B='string'
echo $A
eval echo $A
prints
COHERENT Lexicon Page 1
eval Command eval
$B
string
In the first echo the shell performs substitution only once.
The shell executes eval directly.
***** See Also *****
commands, sh
COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.