Csh substitution
liberte at uiucdcsp.UUCP
liberte at uiucdcsp.UUCP
Thu Jan 10 18:32:00 AEST 1985
This csh trick has been puzzling me too long:
Inside a command substitution, I want to do a variable substitution but
not a filename expansion on the variable's value. I cant seem to get one
without the other. For example:
set x = "ls .*"
set z = `echo $x`
echo "$z"
outputs:
ls . .. .cshrc .login
which is reasonable, but what I want is:
ls .*
You would think that using "$x" or $x:q instead of $x would do it:
set z = `echo "$x"`
Surprise. Same thing results.
----------------------------------
If we try:
set x = "ls .*"
set y = '"$x"'
set z = `echo $y`
echo $z # notice no '"'s
we get:
"$x"
since the '"'s are quoted too.
----------------------------------
So let's try:
set z = `eval echo $y`
echo "$z"
back to:
ls . .. .cshrc .login
----------------------------------
Same thing with:
set z = `eval echo " $x:q "`
and
set z = `echo " $x:q "`
and
set y = "echo $x:q"
set z = `$y`
------------------------------------
I am out of creative ideas...
mail and I'll post,
Daniel LaLiberte
University of Illinois, Urbana-Champaign
usenet: ihnp4!uiucdcs!liberte
arpanet: liberte at uiucdcs.Uiuc.ARPA
More information about the Comp.unix
mailing list