You are not logged in. Login Now
 0-13   14-35         
 
Author Message
cross
The Unix shell item Mark Unseen   Sep 17 00:22 UTC 2006

Debate and study the differences between Unix shells in this item.
35 responses total.
remmers
response 1 of 35: Mark Unseen   Sep 18 15:16 UTC 2006

Bourne shell and its derivatives = good
C shell and its derivatives = evil
gull
response 2 of 35: Mark Unseen   Sep 18 18:57 UTC 2006

C shell is okay as long as you don't try to write scripts in it.
other
response 3 of 35: Mark Unseen   Sep 18 20:14 UTC 2006

Would someone knowledgeable in the subject please post a quick (and
preferably untainted by overt bias) summary of the primary feature
differences between the top several command shells?  If possible, also
list generally recognized positive and negative features of each.
cross
response 4 of 35: Mark Unseen   Sep 19 04:01 UTC 2006

The Bourne Shell: /bin/sh (or direct replacement)

The standard 7th Edition shell.  Originally, quite a weird implementation
(it allocated memory by trapping signals and increasing the size of the data
segment instead of just calling malloc, and used preprocessor symbols to
make the code look like a sort of weird variant of ALGOL).  Most modern
versions contrain job control.

The C-Shell: /bin/csh

Developed at Berkeley by Bill Joy.  Descended from the 6th Edition shell
and, while it has some useful features (job control, command history and
associated syntax for its manipulation, file name completion, the use of the
tilde (~) to refer to a user's home directory [default current user]), it
lacks some of the better ones incorporated into the Bourne shell (like the
ability to redirect individual file descriptors.  E.g., for output, you can
either redirect stdout (>) or stdout and stderr together (>&).  In
particular, you cannot easily redirect stderr independently of stdout).  CSH
was designed to have a "C-like" syntax, but I've never really understood
this; it doesn't look particularly C-like to me.  At this stage, mostly
historical.

The Tenex C-Shell: tcsh (non-standard)

This took the C shell, and added to it "Tenex-style" command and filename
completion, and command line editting using vi or emacs style keybindings
(similar to GNU's readline library).  Much more usable than pure C shell
once you get the hang of it.

The Korn Shell: /bin/ksh

Developed at AT&T by David Korn and others.  Derived from the Bourne shell,
but with command recall facilities similar to CSH and many other advanced
features (a command-line editting facility with either emacs or vi modes,
etc).  Supposedly the basis for the POSIX shell, though most systems ship
some sort of Bourne-like shell or derivitive, or the C shell.

The Bourne-again Shell: bash (non-standard)

The GNU reimplementation of the Bourne shell, with lots of new features and
enhacements.  It features command and filename completion, command line
editing, job control, command history and recall with editting, etc.  Pretty
much standard on Linux, much more capable than the original Bourne shell,
and containing pretty much the union of features of all the shells
previously mentioned.  Often criticized for being *too* big and
correspondingly slow.

The 9th Edition Shell: rc (non-standard)

A brand new shell with a syntax reminiscent of the Bourne shell, but far
more regular.  This one actually looks kinda like C; it's far simpler than
any of the others listed here,  but remains powerfl.  It has been adopted as
the standard shell under Plan 9.  Cedes things like job control, history,
command history and command line editing to other programs (under Plan 9,
the window system mostly).

The Extensible shell: es (non-standard)

Based on a Unix-only clone of rc, featuring an embedded Scheme interpreter.
Interesting, but not hugely popular.  A patch to add job control exists.

The Z shell: zsh (non-standard)

Another Bourne-derived shell, quite full-featured.  Nate and Jeff are both
users of zsh; perhaps they can comment further.

I think that's most of the biggies.
twenex
response 5 of 35: Mark Unseen   Sep 19 15:14 UTC 2006

Some of the BSDs (and probably some of the Linux distributions) also used
cut-down or statically-linked shells such as ash, either for system repair
or as the default shell for root (the administrator account). 

ZSH has some nifty features, such as being able to go to a directory by typing
its name alone, instead of after "cd", and completion for just about
everything (such as command options and manpages). For example, if I have the
following files in my home directory:

README_Solaris8.txt
README_Solaris9.txt
REALLY_LONG_FILE.txt

and want to read README_SOlaris9.txt. If I type:

cat R<tab><tab>

The shell will beep on the first <tab> and display a list of files beginning
with R. If I then type the letters the two README files have in common,
("EAD") and then <tab> the shell will type out:

$ cat README_Solaris

If I then type 9<tab>, the shell will then complete README_Solaris9.txt.

It's even more useful when trying to find a manpage!
gull
response 6 of 35: Mark Unseen   Sep 19 21:14 UTC 2006

One feature I remember seeing somewhere, but now can't remember where, 
is a directory stack.  You could 'push' on the current directory, 
change to another one, do some work, then 'pop' back to the original 
one.  It's a feature I've occasionally wished for when I was deep in a 
directory hierarchy.
cross
response 7 of 35: Mark Unseen   Sep 20 04:11 UTC 2006

tcsh has that feature; I suspect bash and a few of the others do as well. 
Wow, I've forgotten a lot.  I do remember that csh does the same.
naftee
response 8 of 35: Mark Unseen   Sep 20 04:38 UTC 2006

there's also tclsh .
cross
response 9 of 35: Mark Unseen   Sep 20 05:11 UTC 2006

Probably not what you'd want to use for interactive use....
remmers
response 10 of 35: Mark Unseen   Sep 20 13:10 UTC 2006

Re #6:  pushd and popd are in csh, tcsh, and zsh (but not sh or ksh).
cross
response 11 of 35: Mark Unseen   Sep 20 22:15 UTC 2006

John, did you check bash at all?
gull
response 12 of 35: Mark Unseen   Sep 20 23:24 UTC 2006

Looks like bash has it, too.  What's weird is I thought I'd looked for 
it and failed to find it.  I think I was probably looking at the 
bash(1) manpage instead of the bashbuiltins(1) one.
cross
response 13 of 35: Mark Unseen   Sep 20 23:35 UTC 2006

That's another complaint about bash: too many man pages and startup files.
Well, that's my complaint, anyway.
 0-13   14-35         
Response Not Possible: You are Not Logged In
 

- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss