Eval troubles in sh (1)

Paul John Falstad pfalstad at phoenix.Princeton.EDU
Fri Sep 14 05:27:44 AEST 1990


In article <1990Sep13.181238.4388 at ecn.purdue.edu> irick at ecn.purdue.edu (GarBear Irick) writes:
>one=YES
>VAR=one
>eval echo VAR from echo: \$$VAR
>tmp1=`eval echo \$$VAR`
>eval tmp2=`eval echo \$$VAR`
>echo TMP1: $tmp1
>echo TMP2: $tmp2

sh removes backslashes inside backquotes.  Try these lines instead:

tmp1=`eval echo \\\$\$VAR`
eval tmp2=`eval echo \\\$\$VAR`

This will produce YES both times.

  David Hemmings appeared by permission of the National Forestry Commission.



More information about the Comp.unix.questions mailing list