Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!eecae!cps3xx!cps3xx.egr.msu.edu!ben From: ben@nsf1.mth.msu.edu (Ben Lotto) Newsgroups: comp.unix.wizards Subject: Re: awk and shell question Message-ID: Date: 5 Oct 89 14:52:08 GMT References: <4926@macom1.UUCP> <200@megadata.mega.oz> Sender: usenet@cps3xx.UUCP Organization: Michigan State University Lines: 20 In-reply-to: ganga@megadata.mega.oz's message of 3 Oct 89 07:47:42 GMT On 3 Oct 89 07:47:42 GMT, ganga@megadata.mega.oz (Ganga Varatharajan) said: Ganga> I'm trying to alias d (csh) as: Ganga> % dirs -l | awk '{ for (i = 1; i < NF+1; i++) { print i-1,$i } }' Ganga> to list the directory stack one per line and numbered. Try the following: alias d "dirs -l | awk '{ for (i = 1; i < NF+1; i++) { print i-1,"'$i'" } }'" The problem is that any variable is automatically evaluated when enclosed in double quotes. So when you get to the variable, end the double quotes and enclose the variable you want in single quotes. -- -B. A. Lotto (ben@nsf1.mth.msu.edu) Department of Mathematics/Michigan State University/East Lansing, MI 48824