From: utzoo!decvax!pur-ee!davy
Newsgroups: net.unix-wizar
Title: Re: RE: redo - (nf)
Article-I.D.: pur-ee.477
Posted: Sun Aug  1 01:26:59 1982
Received: Mon Aug  2 00:45:31 1982

#R:psuvax:-106600:pur-ee:500007:000:2456
pur-ee!davy    Jul 31 14:14:00 1982


	I have discovered a problem with Dave's "redo" alias, and I'm
not quite sure how one would go about fixing it.  Let's say I have a 
command which looks like:

			man foo | lpr

	Now, if I do a "redo" on that, all that shows up in the file is
"man foo".  What is happening is this:  the output from "ex" is getting 
piped through "lpr", not the changed command!

	Aside from this, the only other disadvantage to using redo is that
the new command does NOT go into your history list, thus, you can't execute 
it again with something like "!!".  Other than that, the editing idea is nice, 
although I have become pretty proficient at using the editing features built 
in to csh, and probably wouldn't use redo too much.

	For those of you who haven't bothered to learn csh's editing features,
here is a quick summary of the three most useful commands:

	1)  The '^' character works on the previous command only, and may be 
	used for correcting spelling, as in:

		you:	% wha am i
		csh:	wha: command not found.
		you:	% ^a^o
		csh:	who am i
			

	This command does not cover spaces, so you cannot change more than one 
	"word".  You can also do things like:

		^who^where davy		- change command completely
		^davy^joe		- change argument
		^joe^			- delete argument

	2) The "s" command.  This command is basically like the "s" in ex, and 
	works as follows.  You give it a command reference, like "!!" or "!30", 
	or "!-3", followed by a colon (:) and then the substitution command:

		you: 	foo -a -b bar
			
		you:	!!:s/-a -b/-c -d
		csh:	foo -c -d bar
			

	3) The "g" command.  The "g", when placed in front of an "s" command, 
	implies global substitution.  Say you had two programs, "acudaily" and 
	"acpdaily", both of which needed compiling.  You could type both 
	commands, or, do this:

		you:	cc -O -s -DPURDUE-EE -o acudaily acudaily.c -lm 
			
		you: 	!!:gs/acu/acp
		csh:	cc -O -s -DPURDUE-EE -o acpdaily acpdaily.c -lm
			

Just by using the three things above, I am able to do just about anything I 
want with my history list, and only occaisionally do I have a problem which 
I can't change.  There are zillions of other things the manual describes to
help you edit commands, but I think most of them are rather specialized, and
a waste of time to bother memorizing.

--Dave Curry
decvax!pur-ee!davy
ucbvax!pur-ee!davy