Xref: utzoo comp.unix.amiga:1100 comp.unix.shell:2515 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!uunet!mcsun!ukc!acorn!ixi!ixi!pd From: pd@x.co.uk (Paul Davey) Newsgroups: comp.unix.amiga,comp.unix.shell Subject: Re: SVR4 /bin/sh BUG Message-ID: Date: 25 Jun 91 08:09:07 GMT References: <1991Jun17.234824.20461@jato.jpl.nasa.gov> <1991Jun18.023211.25558@msuinfo.cl.msu.edu> <1991Jun21.171711.1760@mccc.edu> Sender: paul@x.co.uk (Paul Davey) Organization: IXI Ltd. Lines: 73 In-Reply-To: pjh@mccc.edu's message of 21 Jun 91 17: 17:11 GMT >>>>> On 21 Jun 91 17:17:11 GMT, pjh@mccc.edu (Pete Holsberg) said: Pete> In article pd@x.co.uk (Paul Davey) writes: Pete> =Also ksh doesn't have the ability to refer to !-5:3 (not that I do Pete> =this very often but !131$ or !132* are very useful. Pete> What do they mean? Csh substitutions beginning with ! are history substitutions The general form is (see csh(1) for accuracy - this is from memory) ![:]... In many cases the : is optional. !131 means place the whole of command 131 on the command line, so with no other text it just repeats command 131. As well as absolute numbers as shown by the history command relative numbers may be used. !:-3 is replaced by the command before last. !:-2 and !:-1 by the previous command. The !! command is also a sysnonym for !:-2 (or !-1). I find the absolute references more useful than the relative, of which I usually only use !!. [ Note: !?foo can be used as a reference to the last command containing the string foo, !bar refers to the last command starting with bar. ] Possible modifiers include numbers which represent elements of the command !:0 arg0 !:1 first argument !:2 second argument etc !:$ last argument !:* all argument Colons can generally be omited where possible so !131$ means the last argument of command 131 !132* means the all arguments of command 132 !-5:3 means the third argument of the fifth previous command (includes the command line under constructiuon) Other modifiers may be used, :p is very useful, when added it makes the whole command line Print, so it can be checked before execution. It is added to the history list and can be executed with !!. !*, !$, !?* are all useful forms, if you know the rules. eg 1 vi verylongname.c foobar.c 2 cc -g !$ 3 a.out 4 dbx !! 5 !! 6 vi !cc:$ 7 indent !1* -- Regards, pd@x.co.uk IXI Limited Paul Davey pd@ixi.uucp 62-74 Burleigh St. ...!uunet!ixi!pd Cambridge U.K. "These are interesting times" +44 223 462 131 CB1 1OJ USA: 1 800 XDESK 57