[comp.unix.wizards] Thank you, Bill Joy!

vixie@decwrl.dec.com (Paul Vixie) (08/21/88)

I just got a smile out of a command which sort of jumped out of my fingers,
ahead of my brain.  I thought that the csh gets enough bad publicity that
I'd share the cause of my grin:

% mkdir {man,cat}{1,2,3,4,5,6,7,8}
% ls -l
total 16
drwxrwxr-x  2 root          512 Aug 20 16:15 cat1/
drwxrwxr-x  2 root          512 Aug 20 16:15 cat2/
drwxrwxr-x  2 root          512 Aug 20 16:15 cat3/
drwxrwxr-x  2 root          512 Aug 20 16:15 cat4/
drwxrwxr-x  2 root          512 Aug 20 16:15 cat5/
drwxrwxr-x  2 root          512 Aug 20 16:15 cat6/
drwxrwxr-x  2 root          512 Aug 20 16:15 cat7/
drwxrwxr-x  2 root          512 Aug 20 16:15 cat8/
drwxrwxr-x  2 root          512 Aug 20 16:15 man1/
drwxrwxr-x  2 root          512 Aug 20 16:15 man2/
drwxrwxr-x  2 root          512 Aug 20 16:15 man3/
drwxrwxr-x  2 root          512 Aug 20 16:15 man4/
drwxrwxr-x  2 root          512 Aug 20 16:15 man5/
drwxrwxr-x  2 root          512 Aug 20 16:15 man6/
drwxrwxr-x  2 root          512 Aug 20 16:15 man7/
drwxrwxr-x  2 root          512 Aug 20 16:15 man8/
-- 
Paul Vixie
Digital Equipment Corporation	Work:  vixie@dec.com	Play:  paul@vixie.UUCP
Western Research Laboratory	 uunet!decwrl!vixie	   uunet!vixie!paul
Palo Alto, California, USA	  +1 415 853 6600	   +1 415 864 7013

daveb@llama.rtech.UUCP (Dave Brower) (08/26/88)

In article <65@volition.dec.com> vixie@decwrl.dec.com (Paul Vixie) writes:
>I just got a smile out of a command which sort of jumped out of my fingers,
>ahead of my brain.  I thought that the csh gets enough bad publicity that
>I'd share the cause of my grin:
>
>% mkdir {man,cat}{1,2,3,4,5,6,7,8}

This is the single, lonesome, only thing that I like about csh that
isn't done adequately or better in ksh or the BRL sh.

Anybody got any ideas how (syntactically) to stick a similar feature in?

-dB
"Ready when you are Raoul!"
{amdahl, cpsc6a, mtxinu, sun, hoptoad}!rtech!daveb daveb@rtech.com <- FINALLY!

kre@munnari.oz (Robert Elz) (08/27/88)

In article <2402@rtech.rtech.com>, daveb@llama.rtech.UUCP (Dave Brower) writes:
> [Quotes:] >% mkdir {man,cat}{1,2,3,4,5,6,7,8}
> This is the single, lonesome, only thing that I like about csh that
> isn't done adequately or better in ksh or the BRL sh.

It is an important one, but !$ is just as important.  I have never used
a BRL sh, but ksh's $_ (while useful itself sometimes), just doesn't come
close.

What is needed is a way to do

	ls /a >/tmp/file
	ls /b | comm - !$
or
	echo old*
	rm !$

neither of which will do anything like what you want if you replace
csh with ksh and !$ with $_

kre

rwl@uvacs.CS.VIRGINIA.EDU (Ray Lubinsky) (08/28/88)

In article <2402@rtech.rtech.com>, daveb@llama.rtech.UUCP (Dave Brower) writes:
> In article <65@volition.dec.com> vixie@decwrl.dec.com (Paul Vixie) writes:
> >% mkdir {man,cat}{1,2,3,4,5,6,7,8}
> 
> This is the single, lonesome, only thing that I like about csh that
> isn't done adequately or better in ksh or the BRL sh.
> 
> Anybody got any ideas how (syntactically) to stick a similar feature in?

Yeah...

	$ csh -fc 'mkdir {man,cat}{1,2,3,4,5,6,7,8}'

:-)

-- 
| Ray Lubinsky,                    UUCP:      ...!uunet!virginia!uvacs!rwl    |
| Department of                    BITNET:    rwl8y@virginia                  |
| Computer Science,                CSNET:     rwl@cs.virginia.edu  -OR-       |
| University of Virginia                      rwl%uvacs@uvaarpa.virginia.edu  |

fnf@fishpond.UUCP (Fred Fish) (08/28/88)

In article <2323@munnari.oz> kre@munnari.oz (Robert Elz) writes:
>It is an important one, but !$ is just as important.  I have never used
>a BRL sh, but ksh's $_ (while useful itself sometimes), just doesn't come
>close.
>	[Examples of use of csh !$ deleted  -fnf]
>neither of which will do anything like what you want if you replace
>csh with ksh and !$ with $_

Are you confusing <ESC><_>  with <ESC><.>  ?

As far as I can tell, and I'm not a csh user, the ksh <ESC><.> sequence
does exactly what the csh !$ mechanism does, except that ksh echos the
line to be executed before you hit CR, while csh echoes it afterwards:

Script started on Sat Aug 27 12:40:06 1988
fishpond:1574> csh
% echo a b c
a b c
% echo !$
echo c 
c
% ls /x/usr/fnf/bin/*
/x/usr/fnf/bin/OLDbru
/x/usr/fnf/bin/analyze
/x/usr/fnf/bin/beep
% ls !$
ls /x/usr/fnf/bin/* 
/x/usr/fnf/bin/OLDbru
/x/usr/fnf/bin/analyze
/x/usr/fnf/bin/beep
% exit
fishpond:1575> ksh
fishpond:1576> echo a b c
a b c
fishpond:1577> echo c			(I actually typed "echo <ESC><.>")
c
fishpond:1579> ls /x/usr/fnf/bin/*
/x/usr/fnf/bin/OLDbru
/x/usr/fnf/bin/analyze
/x/usr/fnf/bin/beep
fishpond:1580> ls /x/usr/fnf/bin/*	(I actually typed "ls <ESC><.>")
/x/usr/fnf/bin/OLDbru
/x/usr/fnf/bin/analyze
/x/usr/fnf/bin/beep
fishpond:1581> exit
fishpond:1583> exit

script done on Sat Aug 27 12:42:05 1988
-- 
# Fred Fish, 1346 West 10th Place, Tempe, AZ 85281,  USA
# noao!nud!fishpond!fnf                   (602) 921-1113

rwl@uvacs.CS.VIRGINIA.EDU (Ray Lubinsky) (09/01/88)

In article <2323@munnari.oz>, kre@munnari.oz (Robert Elz) writes:
> What is needed is a way to do
> 
> 	ls /a >/tmp/file
> 	ls /b | comm - !$
> or
> 	echo old*
> 	rm !$
> 
> neither of which will do anything like what you want if you replace
> csh with ksh and !$ with $_

Jeez!  Use the bleeding edit mode in Korn shell!

Using vi-style command line editing I can modify previous commands like you've
shown in at least the amount of time you can do it with csh's !$ construct AND
I get the visual reassurance of seeing what the newly-edited command is really
going to be.

Csh history editing mechanism is a pitiful kludge compared to actually EDITING
your past commands.  (I cut my teeth on csh so its not that I haven't seen
both sides of the UNIX shell fence.)  Hunt-and-peck typists need not apply.

-- 
| Ray Lubinsky,                    UUCP:      ...!uunet!virginia!uvacs!rwl    |
| Department of                    BITNET:    rwl8y@virginia                  |
| Computer Science,                CSNET:     rwl@cs.virginia.edu  -OR-       |
| University of Virginia                      rwl%uvacs@uvaarpa.virginia.edu  |

rodc@unet.unet.pacbell.COM (Rod Creason) (09/01/88)

In article <2662@uvacs.CS.VIRGINIA.EDU> rwl@uvacs.CS.VIRGINIA.EDU (Ray Lubinsky) writes:
>Using vi-style command line editing I can modify previous commands like you've
>shown in at least the amount of time you can do it with csh's !$ construct AND
>I get the visual reassurance of seeing what the newly-edited command is really
>going to be.
>
>Csh history editing mechanism is a pitiful kludge compared to actually EDITING
>your past commands.  (I cut my teeth on csh so its not that I haven't seen
>both sides of the UNIX shell fence.)  Hunt-and-peck typists need not apply.

I agree completely.  I used csh for many years until I was without and
had to use ksh.  Now that I have used the korn shell I will only use csh
when I must (at work we do not have ksh).  The editing capabilities are
wonderful (it even supports 'undo').


-------------
Rod Creason,                    uucp:      ...!{ames,amdahl,pacbell}!unet!rodc
Advanced Development,           
Network Equipment Technologies 

jgy@hropus.UUCP (John Young) (09/06/88)

> In article <2323@munnari.oz>, kre@munnari.oz (Robert Elz) writes:
> > What is needed is a way to do
> > 
> > 	ls /a >/tmp/file
> > 	ls /b | comm - !$
> > or
> > 	echo old*
> > 	rm !$
> > 
> > neither of which will do anything like what you want if you replace
> > csh with ksh and !$ with $_

How about this (in ksh)

	comm <(ls /a) <(ls /b)

No temporary files, no !$'s or $_'s etc....

Of course you need the /dev/fd driver but....

russell@labtam.OZ (Russell McDonell) (09/11/88)

From article <2323@munnari.oz>, by kre@munnari.oz (Robert Elz):
> 
> What is needed is a way to do
> 
> 	ls /a >/tmp/file
> 	ls /b | comm - !$
> or
> 	echo old*
> 	rm !$
> 
> neither of which will do anything like what you want if you replace
> csh with ksh and !$ with $_
> 
O.K. - I picked up on this debate late. May be I have missed something.
However I don't understand why command line editing does not result in
a better equivalent. Both can be done in ksh.
> ls /b | comm - !$ = <ESC>-EE3c b | comm - <RET>
> rm !$ = <ESC>-cwrm <RET>
It seems to me the advantages are :-
1. You get to use the editor of your choice - vi in my case.
2. You only have to learn one set of editing rules.
3. What you see is what you get. The final command line is exactly what
   you wanted, not some shorthand abreviation of hieroglyphics.
4. The number of key strokes functionally equivalent. After all the
   actual number of key strokes, with in reason, is surely not an
   appropriate measure of the functional usefulness of a man/machine
   inferface? I would have though ease of comprehension and ease of
   learning via transference of skills was more relevant.
D