Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!sun!smile!alanf From: alanf%smile@Sun.COM (Alan Fargusson @ peace with the world) Newsgroups: comp.sources.d Subject: Re: Bourne Again Shell? Summary: _ Message-ID: <90314@sun.uucp> Date: 17 Feb 89 22:09:53 GMT References: <26563@teknowledge-vaxc.ARPA> <42400008@uicsrd.csrd.uiuc.edu> <278@tscs.UUCP> Sender: news@sun.uucp Lines: 34 Most people seem unaware of the _ construct in the Korn shell. This construct gives you the nth parameter from the previous command. For some reson the parameters are numbered from one, so 1_ give you the command name. I do miss the {} construct. In article <278@tscs.UUCP>, root@tscs.UUCP (Admin) writes: > > (1): tar cvf /tmp/foobar ./{src,bin} ./local/bar tar cvf /tmp/foobar ./src ./bin ./local/bar > (2): chmod 440 !:2 (expands to: chmod 440 /tmp/foobar) chmod 440 3_ > (3): chown root !$ (expands to: chown root /tmp/foobar) chown root $_ or chown root _ > (4): ls -l !ta:3-$ (expands to: ls -l ./{src,bin} ./local/bar) > (which works out to: ls -l ./src ./bin ./local/bar) I would do this by editing the command line and removing everything up to the parameters I wanted, then inserting the ls -l. It isn't that bad. Whenever I try and do something like number 4 in csh I usually blow it and end up typing the whole thing in anyway. The _ construct expands when you type it so if you get it wrong you can backspace and try again. - - - - - - - - - - - - - - - - - - - - - Alan Fargusson Sun Microsystems alanf@sun.com ..!sun!alanf