

eval                         Command                         eval




Evaluate arguments

eevvaall [_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


