Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!nucsrl!accuvax.nwu.edu!gamma.eecs.nwu.edu!jacobson From: jacobson@gamma.eecs.nwu.edu (Dan Jacobson) Newsgroups: comp.unix.wizards Subject: Re: csh vs sh (was: fixing rm *) Message-ID: <419@accuvax.nwu.edu.NWU.EDU> Date: 18 Dec 88 11:28:57 GMT References: <1812@ndsuvax.UUCP> <717@quintus.UUCP> <6518@csli.STANFORD.EDU> <723@quintus.UUCP> <6550@csli.STANFORD.EDU> <1457@unisoft.UUCP> Sender: news@accuvax.nwu.edu.NWU.EDU Reply-To: jacobson@eecs.nwu.edu (Dan Jacobson) Organization: Northwestern University, Evanston IL, USA Lines: 62 Sender: [Originally I planed to respond to John Richardson's e-mail by e-mail, but I thought I might share my golden keystrokes with the community.] I use tcsh (Ohio-state's) and ksh for interactive work, sh for scripts. Doesn't the Geneva Convention say you must provide your users with shells with command line editing (e.g. a la emacs)? I turn in fright when faced with the prospect of typing into csh or sh for interactive work without the protection of at least a (GNU) emacs shell window, lest I make a typo and have to type the whole line over. Csh's "!" history substitutions are a lot of cruft to me, now that command line editing shells are available. Try "set histchars" to turn it off. Tcsh is quite flexible. You can define each key individually. In ksh I believe you choose between the (given) emacs or vi, etc. key definition sets. Tcsh also has one touch file and command name expansion; ksh file name expansion is hardwired(?) to ESC * . The tcsh prompt I give to all new accounts is packed with info: time, 1 letter hostname and current directory are achieved with: set prompt="%S%t `/bin/expr $HOST : '\(.\)'`:%c>%s " which gives: 10:57pm g:~> (but in reverse video) You have to go thru major contortions to do most of this fancy prompting with ksh. My tcsh prompt also sometimes has: root's "#", "screen" (a terminal emulator by Oliver Laumann) window number, and shell level depth. Actually I'm waiting for GNU's "Bourne again shell" (what will it have?). My interactive commands, most not being multiline, would be the same in all the shells mentioned, mostly. True, the csh family's (csh, tcsh) "repeat", "@" etc. commands are useful. BSD users see their sh scripts with "test" calls run slower than their csh scripts with built-in (e.g. "if (-e file) command") calls because "test" is not built-in in BSD's sh and instead lives in /bin/test (linked to "/bin/[" !). I have been burned by csh's limitations on piping into loops, manipulating standard output and error, etc, and generally think sh is more robust. In sh you get to play with many file descriptors and traps, etc. Portability is very important to me. I don't think I'm forcing myself to use a less flexible shell for portability's sake. I would still use sh, portable or not. If I were to write a csh script, I wouldn't use tcsh instead. I don't usually need the interactive advantages of tcsh in a script, and csh would be more portable. Well, that's the last of my effort for shell wars... please debate this amongst yourselves. Now on to other wars, e.g. "notes" (boo) vs. "rn" (yea!) vs. .... Dan Jacobson -- jacobson@eecs.nwu.edu or {oddjob,gargoyle,att,...}!nucsrl!jacobson