Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site decuac.UUCP Path: utzoo!watmath!clyde!cbosgd!decuac!avolio From: avolio@decuac.UUCP (Frederick M. Avolio) Newsgroups: net.unix Subject: Re: Help! Csh is eating my brain.... Message-ID: <656@decuac.UUCP> Date: Sat, 19-Oct-85 10:15:04 EDT Article-I.D.: decuac.656 Posted: Sat Oct 19 10:15:04 1985 Date-Received: Sun, 20-Oct-85 06:10:13 EDT References: <366@zaphod.UUCP> Organization: ULTRIX Applications Center, MD Lines: 52 In article <366@zaphod.UUCP>, flory@zaphod.UUCP (Trevor Flory) writes: > Hello All; > I'm trying to debug a csh script written by someone who > knew what he was doing I'm sure. Below is a fragment of > the script which I find rather difficult to understand: > ... > alias readandset 'echo -n \!:1 ; set \!:2 = $< ' > ... > readandset "Choice? " chvar > ... > if("$chvar" == "quit") .... > > In particular I'd like to know what \!:1 or \!:2 means/does. If you look at a command line, the first word is in position 0, the next in position 1, and so on. !:n (where n is a non-negative number) the csh replaces the string with the word in the nth position from the previous command. (!:1 is the first word. !22:3 is the 3rd word from command #22 in the history and so on....) Example -- % ls -ld t* drwx--x--x 16 avolio 1024 Oct 17 15:23 text -rw-r--r-- 1 avolio 0 Oct 19 10:10 todo % ls !:2 ls t* todo text: cust.support decnet.info decuac kermit mail paths products qpr training uac uig ultrix11 ultrix32 venix ----- % echo a b c a b c % echo !:3 echo c c % And so on..... Fred.