Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!ames!dftsrv!chris From: chris@asylum.gsfc.nasa.gov (Chris Shenton) Newsgroups: comp.unix.shell Subject: Re: Delayed evaluation of csh variables? Message-ID: Date: 11 Dec 90 17:37:53 GMT References: <110255@convex.convex.com> Sender: news@dftsrv.gsfc.nasa.gov Organization: NASA Goddard Space Flight Center; Greenbelt, MD Lines: 27 In-reply-to: tchrist@convex.COM's message of 11 Dec 90 00:24:07 GMT Thanks to everyone who responded (mail and posts) on my query. This is a ``best-of'' from the suggestions. 1. The quoting can be simplified by nixing the " and using ' instead. 2. Eval -- this is the key -- is needed to instantiate the variable in the string. Here's the simplest example thing I've come up with: #!/bin/csh -vxf # show whazzup; ignore .cshrc set COMMAND = 'ls -l $File' # simple single quotes do the trick foreach File ( $* ) # do all command line arguments eval $COMMAND # eval to instantiate $File end tchrist@convex.com insists that I shouldn't be doing any programming in csh. Probably true, but I'm too lazy to get intimate with sh for such short stuff. (I'd rather learn bash!) Again, many thanks to everyone. Ciao! -- chris@asylum.gsfc.nasa.gov, ...!uunet!asylum.gsfc.nasa.gov!chris, PITCH::CHRIS