Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site uiucdcsp.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!inuxc!pur-ee!uiucdcsp!liberte
From: liberte@uiucdcsp.UUCP
Newsgroups: net.unix
Subject: Csh substitution
Message-ID: <17300001@uiucdcsp.UUCP>
Date: Thu, 10-Jan-85 03:32:00 EST
Article-I.D.: uiucdcsp.17300001
Posted: Thu Jan 10 03:32:00 1985
Date-Received: Sat, 12-Jan-85 05:15:50 EST
Lines: 61
Nf-ID: #N:uiucdcsp:17300001:000:1139
Nf-From: uiucdcsp!liberte    Jan 10 02:32:00 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@uiucdcs.Uiuc.ARPA