Ksh use (was Re: Should ``csh'' be part of ...)

Brandon S. Allbery allbery at ncoast.UUCP
Thu May 26 10:13:41 AEST 1988


As quoted from <2199 at quacky.mips.COM> by dce at mips.COM (David Elliott):
+---------------
| 1. It's really nice to be able to say
| 
| 	rcsdiff -r1.{2,4} foo.c
| 
|    Does ksh have anything like {}?  (In case you don't know, "-r1.{2,4}"
|    expands to "-r1.2 -r1.4".)
+---------------

Not as far as I've been able to tell.  I agree that it's useful; especially
since it can be used on non-filenames and it doesn't sort its expansion.

+---------------
| 	% foo bar
| 	...
| 	% ^oo^ob^		# change first foo to foob
| 	fob bar
+---------------

k$ r oo=ob
fob bar

+---------------
| 	% mv foo.c foo.c.old
| 	% !!:gs/foo/bar/	# change all foo to bar
| 	mv bar.c bar.c.old
+---------------

This one's harder:  no global substitution mechanism.  You can use

k$ r foo=bar foo=bar

or you can use emacs or vi mode and edit the command line.  This didn't
bother me too much, as we have the buggy csh that's commonly distributed by
System III/V VARs... since I have histchars=^@ so I can send UUCP mail
without sprouting backslashes every which way, global search-and-replace
only works right if I add :p the first time and actually run it the second
time -- otherwise, it ignores the 'g'.  (Strange.)
-- 
	      Brandon S. Allbery, moderator of comp.sources.misc
	{well!hoptoad,uunet!marque,cbosgd,sun!mandrill}!ncoast!allbery
Delphi: ALLBERY						     MCI Mail: BALLBERY



More information about the Comp.unix.wizards mailing list