Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!osu-cis!killer!rpp386!ditka!stb!michael From: michael@stb.UUCP (Michael) Newsgroups: comp.sources.d Subject: Re: Bourne Again Shell? Message-ID: <10666@stb.UUCP> Date: 20 Mar 89 20:16:06 GMT References: <26563@teknowledge-vaxc.ARPA> <46100006@hcx3> <1491@vicom.COM> <10659@stb.UUCP> <237@tree.UUCP> Reply-To: michael@stb.UUCP (Michael) Organization: STB BBS, La, Ca, Usa, +1 213 459 7231 Lines: 64 In article <237@tree.UUCP> asmodeus@tree.UUCP (Jonathan Ballard) writes: >> Ok. history | fgrep foo | tail -3 | head -1 >> !xyz:0-3 bar !xyz:5-$ >> >> Done. Readable. > >I have no "xyz" command so this trick is useless for me. >Just wanted to say that piping isn't only for csh. Try doing it without >piping in csh. This can't be executed unless you did it with >sh -c `...` Alright. Lets try this again. (30) % history | fgrep foo | tail -3 | head -1 27 foo -i *.a -o *.c -n -xyzzy -l local (31) % !27:0-3 *.b !27:5-$ foo -i *.a -o *.b -n -xyzzy -l local By !xyz in my original posting, I did not mean "command named xyz", I ment the number of the command returned by the original history command. >> Now, my turn: How do you combine multiple commands in the KSH history >> mode? My copy of ksh does not implement vi's yank feature, so I cannot >> combine parts from command 32 with command 35. >> >Well... mine does and a "32GY35G$p" will combine them. >Maybe you used "yy" instead of "Y" as a yank command. Well of course I used yy. Thats how I yank in vi. :-) Just checked. My version of ksh doesn't even support "Y" for yanks. >Another way would be to type "fc -e" and edit the history with the editor >you chose. (real editor - not editor look alike) Then when done >just execute that line. > >> Also, ksh's vi mode has the /'s and ?'s backwards, as well as G (which >> goes to the first command, not the last command). >> >> (I know what you'll say, think of editing a file where the new lines go at >> the top. But then why can't I say 1G, and why are the numbers on the lines >> backwards?) > >/ searchs downwards in a file - search backwards in history >? searchs upwards in a file - searches forwards in history >G alone will goto the least numbered history line. But with a number before > it then it will try to go to that the history line number. > >The numbers are on the l are backwards? Since when? If / goes to higher numbered lines corresponding to earlier commands, then 1G should go to the lowest numbered line (most recent command). It doesm't. This is what I mean by numbers on the lines are backwards. And yes, it does make a difference to me (I hit ? and find nothing like what I expected. I then do "G" to get to the end, but are instead at the beginning. Etc.) >----Asmodeus - Jonathan Ballard ..!csusac!tree!asmodeus Michael : --- : Michael Gersten uunet.uu.net!stb!michael : michael@stb.uu.net crash!gryphon!denwa!stb!michael : "Robitussin" for computers? This has gone too far. Where's "Penicillian"? : (rob. is Coff-medicine to let COFF people run bsd-dependent GNU stuff).