dce@mips.COM (David Elliott) (05/17/88)
In article <4095@mtgzz.UUCP> avr@mtgzz.UUCP (XMRP50000[jcm]-a.v.reed) writes: > >Why would any sane person wish to use csh when they can use ksh? The only reason I don't use ksh is that it appears to lack two features of csh that I use every day. Maybe you folks can help me out. 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".) 2. Having used the csh history mechanism for nearly 8 years, I'm used to being able to do things like % foo bar ... % ^oo^ob^ # change first foo to foob fob bar ... % mv foo.c foo.c.old % !!:gs/foo/bar/ # change all foo to bar mv bar.c bar.c.old I was told once that there was a ksh with a complete csh-style history machanism. Is this true? Of course, I'm not completely insane, since I often go into sh to run loops, and I write on sh scripts, never csh scripts. -- David Elliott dce@mips.com or {ames,prls,pyramid,decwrl}!mips!dce
ndd@duke.cs.duke.edu (Ned Danieley) (05/18/88)
As long as we're talking about ksh, is there any way to do job control without typing fg (and bg)? In csh %2 brings the second stopped job into the foreground; as I understand it, in ksh I have to do fg %2 A minor nit, but when you have 7 or 8 years invested in one shell, the change-over has to be very smooth, or it won't be made. Ned Danieley (ndd@sunbar.mc.duke.edu) Basic Arrhythmia Laboratory Box 3140, Duke University Medical Center Durham, NC 27710 (919) 684-6807 or 684-6942
ado@elsie.UUCP (Arthur David Olson) (05/19/88)
> As long as we're talking about ksh, is there any way to do job > control without typing fg (and bg)? In csh > %2 > brings the second stopped job into the foreground; as I understand it, > in ksh I have to do > fg %2 As someone who made the switch from csh to ksh a while back. . . alias %1='fg %1' alias %2='fg %2' alias %3='fg %3' alias %4='fg %4' alias %5='fg %5' alias %6='fg %6' alias %7='fg %7' alias %8='fg %8' alias %9='fg %9' alias stop='kill -STOP' -- Canada's program is to spaceflight as the carrier pigeon is to mail. ado@ncifcrf.gov ADO is a trademark of Ampex.
rthurlow@van-bc.UUCP (Rob Thurlow) (05/19/88)
I want to bitch about being with a not-huge company. The cost of $2000 for source is hard to justify for a product I believe to be great but have not seen. We have four different System V boxes; you'd think one of the vendors would give out 'ksh' as a freebie. Since I'm dreaming, why can't it be AT&T, who doesn't even give us 'csh' for some reason? Come on guys, this IS 1988; can't I get a computer to remember what I typed for me? Why do they even ship the 3B2 V.2 without a shell which can do history? INFO help_me() { Which reminds me - anyone got a line on where we can buy a binary of 'ksh' for the AT&T 3B2 running System V Release 2? I heard that this was available. That we might be able to buy. } Two other points - In article <2199@quacky.mips.COM> dce@mips.COM (David Elliott) writes: > Does ksh have anything like {}? (In case you don't know, "-r1.{2,4}" > expands to "-r1.2 -r1.4".) NB - this happens regardless of whether any files exist with names like this. There's lots of ways to generate names of files in sh & csh, but not enough to just manufacture arbitrary patterns, in my opinion; this feature bucks that trend. >Of course, I'm not completely insane, since I often go into sh to run >loops, and I write on sh scripts, never csh scripts. Agreed. Only lunatics *prefer* 'csh' for scripts. I just want a Bourne shell with shell functions and history. Does that exist? :-) Disclaimer: My company does not necessarily share my views. But they don't have USENET, so you won't find their name in this message anyway. -- ------------------------------------------------------------------------ "There was something fishy about the butler. I think he was a Pisces, | probably working for scale." - Nick Danger | uunet-----\ | Robert Thurlow !van-bc!rthurlow | ubc-cs----/ | ------------------------------------------------------------------------
ndd@duke.cs.duke.edu (Ned Danieley) (05/19/88)
In article <8066@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes: >> As long as we're talking about ksh, is there any way to do job >> control without typing fg (and bg)? In csh >> %2 >> brings the second stopped job into the foreground; as I understand it, >> in ksh I have to do >> fg %2 > >As someone who made the switch from csh to ksh a while back. . . > > alias %1='fg %1' ... >-- > Canada's program is to spaceflight as the carrier pigeon is to mail. > ado@ncifcrf.gov ADO is a trademark of Ampex. Oh... (slowly rising flush). That wasn't so hard, was it? Thanks. Ned Danieley (ndd@sunbar.mc.duke.edu) Basic Arrhythmia Laboratory Box 3140, Duke University Medical Center Durham, NC 27710 (919) 684-6807 or 684-6942
avr@mtgzz.UUCP (XMRP50000[jcm]-a.v.reed) (05/20/88)
In article <11747@duke.cs.duke.edu>, ndd@duke.cs.duke.edu (Ned Danieley) writes: < As long as we're talking about ksh, is there any way to do job < control without typing fg (and bg)? In csh < < %2 < < brings the second stopped job into the foreground; as I understand it, < in ksh I have to do < < fg %2 < < A minor nit, but when you have 7 or 8 years invested in one shell, < the change-over has to be very smooth, or it won't be made. Just put the following in the ksh $ENV file of every user who wants it: function argfg { fg %$1 } for jobnum in 0 1 2 3 4 5 6 7 8 9 # as many as you allow per user do alias -x %$jobnum="argfg $jobnum"; done I do believe that's smooth enough.... Adam Reed (mtgzz!avr)
friedl@vsi.UUCP (05/20/88)
In article <1771@van-bc.UUCP>, rthurlow@van-bc.UUCP (Rob Thurlow) writes: > INFO help_me() > { > Which reminds me - anyone got a line on where we can buy a binary > of 'ksh' for the AT&T 3B2 running System V Release 2? I heard that > this was available. That we might be able to buy. > } Aspen Tech sells ksh for the 3B2, uport plus probably some others. We use on both abovementioned machines without difficulty. Aspen Technology Box 5727 Parsippany, NJ 07054 (201) 316-0866 -- Steve Friedl V-Systems, Inc. (714) 545-6442 3B2-kind-of-guy friedl@vsi.com {backbones}!vsi.com!friedl attmail!vsi!friedl
ron@topaz.rutgers.edu (Ron Natalie) (05/21/88)
I understand the reason for having to type fg rather than just %1 in the KSH. When I put job control in the Bourne shell (prior to the public release of KSH), the %n expansion is implemented in the same way as the substitution of shell variables. Builtin commands are a little tricky so you have to actually type the name of the builtin command (fg, bg) inorder to make it work. -Ron
rbj@icst-cmr.arpa (Root Boy Jim) (05/25/88)
In article <2199@quacky.mips.COM> dce@mips.COM (David Elliott) writes: > Does ksh have anything like {}? (In case you don't know, "-r1.{2,4}" > expands to "-r1.2 -r1.4".) NB - this happens regardless of whether any files exist with names like this. There's lots of ways to generate names of files in sh & csh, but not enough to just manufacture arbitrary patterns, in my opinion; this feature bucks that trend. Bourne shell (and I assume ksh) use {} to denote a list of commands, similar to a subshell, but executed in the same shell. Thus, I doubt that the pattern generation will ever be implemented unless they can find some free meta-characters. A pity, as I am attached to this feature as well. I do `mv foo.c{,.old}' etc all the time. >Of course, I'm not completely insane, since I often go into sh to run >loops, and I write on sh scripts, never csh scripts. Agreed. Only lunatics *prefer* 'csh' for scripts. I just want a Bourne shell with shell functions and history. Does that exist? :-) Disagreed. Unless your script is trivial, you need features that sh provides, or you want to make your scripts portable, coding in csh is more intuitive. Sh command syntax is braindamaged. ------------------------------------------------------------------------ "There was something fishy about the butler. I think he was a Pisces, | probably working for scale." - Nick Danger | You want some more cotton candy, Danger? uunet-----\ | Robert Thurlow !van-bc!rthurlow | ubc-cs----/ | ------------------------------------------------------------------------ (Root Boy) Jim Cottrell <rbj@icst-cmr.arpa> National Bureau of Standards Flamer's Hotline: (301) 975-5688 The opinions expressed are solely my own and do not reflect NBS policy or agreement My name is in /usr/dict/words. Is yours?
friedl@vsi.UUCP (Stephen J. Friedl) (05/25/88)
In article <14528@brl-adm.ARPA>, rbj@icst-cmr.arpa (Root Boy Jim) writes: < < In article <2199@quacky.mips.COM> dce@mips.COM (David Elliott) writes: < > Does ksh have anything like {}? (In case you don't know, "-r1.{2,4}" < > expands to "-r1.2 -r1.4".) < < Bourne shell (and I assume ksh) use {} to denote a list of commands, < similar to a subshell, but executed in the same shell. Thus, I doubt < that the pattern generation will ever be implemented unless they can < find some free meta-characters. A pity, as I am attached to this feature < as well. I do `mv foo.c{,.old}' etc all the time. Note that the Sys V Bourne shell (and ksh) only recognizes { and } specially when used as the first word of a command, when standing alone, and when not quoted. This context sensitivity would seem to leave room for the very helpful file.{foo,bar} notation of csh. -- Steve Friedl V-Systems, Inc. (714) 545-6442 3B2-kind-of-guy friedl@vsi.com {backbones}!vsi.com!friedl attmail!vsi!friedl
allbery@ncoast.UUCP (Brandon S. Allbery) (05/26/88)
As quoted from <2199@quacky.mips.COM> by dce@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
bd@hpsemc.HP.COM (bob desinger) (05/28/88)
Rob Thurlow (rthurlow@van-bc.UUCP) writes: > We have four different System V boxes; you'd think one > of the vendors would give out 'ksh' as a freebie. Since I'm dreaming, > why can't it be AT&T, who doesn't even give us 'csh' for some reason? When it first came out, AT&T didn't know what to do with ksh; that's why it's in the Toolchest. Their quandary is not surprising---big companies have to worry about throwing marketing resources and test scaffolds and technical writers and all sorts of non-lab people at a project before they can release it. It's very expensive for a big company to release a product; they get sued a lot by unhappy customers who find bugs. > Come on guys, this IS 1988; can't I get a computer to remember what I > typed for me? Why do they even ship the 3B2 V.2 without a shell which > can do history? You *can* get your computer to remember what you typed. You just have to pay $2000 more for it. :-( Actually, HP ships ksh for free on its latest releases of HP-UX. Apple ships ksh with A/UX, from what I hear. It's just a matter of time before more vendors---maybe even AT&T---ship ksh as a matter of course. Look at the omnipresence of csh; why should ksh be any different? > > Does ksh have anything like {}? I'm surprised that Korn hasn't written a shell function to do this. (Maybe his book will give us the code. In his talk, he said that the new ksh book implements the MH programs in about 700 lines of shell. MH is about 30,000 lines of C today!) Okay, ksh hackers, let's implement {} as a function.... -- bd
allbery@ncoast.UUCP (Brandon S. Allbery) (05/31/88)
As quoted from some article lost in the mists of time: +--------------- | > Which reminds me - anyone got a line on where we can buy a binary | > of 'ksh' for the AT&T 3B2 running System V Release 2? I heard that +--------------- Speaking of which: does anyone know if a binary ksh exists for Altos 386 boxes running Altos System V (preferred) or Altos Xenix 5.3? Thanks in advance. -- Brandon S. Allbery, moderator of comp.sources.misc {well!hoptoad,uunet!marque,cbosgd,sun!mandrill}!ncoast!allbery Delphi: ALLBERY MCI Mail: BALLBERY
allbery@ncoast.UUCP (Brandon S. Allbery) (06/03/88)
As quoted from <14528@brl-adm.ARPA> by rbj@icst-cmr.arpa (Root Boy Jim): +--------------- | Bourne shell (and I assume ksh) use {} to denote a list of commands, | similar to a subshell, but executed in the same shell. Thus, I doubt | that the pattern generation will ever be implemented unless they can | find some free meta-characters. A pity, as I am attached to this feature | as well. I do `mv foo.c{,.old}' etc all the time. +--------------- But "{" is legal only if the next token is newline or ";" -- try it! "{" immediately followed by a non-space which is not newline or tab could be recognized as a pattern construct. (I daresay the code would be ugly, though.) +--------------- | Agreed. Only lunatics *prefer* 'csh' for scripts. I just want a Bourne | shell with shell functions and history. Does that exist? :-) | | Disagreed. Unless your script is trivial, you need features that sh | provides, or you want to make your scripts portable, coding in csh | is more intuitive. Sh command syntax is braindamaged. +--------------- I find nothing braindamaged about it: it's quite straightforward and logical. Which is more than I can say for csh, which deludes you into thinking it's C and then hits you with its variant syntax and general stupidity when you least expect it. -- Brandon S. Allbery, moderator of comp.sources.misc {well!hoptoad,uunet!marque,cbosgd,sun!mandrill}!ncoast!allbery Delphi: ALLBERY MCI Mail: BALLBERY
jerryp@cmx.npac.syr.edu (Jerry Peek) (06/05/88)
In article <2199@quacky.mips.COM> dce@mips.COM (David Elliott) writes: > 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".) Back when I was using a system that had ksh, I wrote an alias called qcsh. It passed a commandline to csh and ran it. For instance, I'd type: $ qcsh rcsdiff -r1.{2,4} foo.c To set it up, I put this alias in my .profile: alias qcsh=". ~/ksh/qcsh" And this file in ~/ksh/qcsh: --------- CUT HERE FOR qcsh FILE ---------------- # USING "csh -fc $*" WON'T EXPAND THINGS LIKE a{b,c,d}... SO, USE TEMP FILE: echo "$@" > /tmp/q$$ csh -f /tmp/q$$ rm -f /tmp/q$$ set -- --------- END OF qcsh FILE --------------------- Quick and dirty, but it worked just fine. --Jerry Peek, Northeast Parallel Architectures Center, Syracuse, NY 13244-1260 jerryp@cmx.npac.syr.edu +1 315 423-4120