Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] shell scripts



On Tue, Feb 03, 2004 at 04:14:55PM +0900, Stephen J. Turnbull wrote:
> >>>>> "Brett" == Brett Robson <b-robson@example.com> writes:
> 
>     Brett> Does anyone know which is the most common Unix script these
>     Brett> days? (I mean Unix not Linux). I'd assume that korn shell,
>     Brett> but I haven't worked on Unix for a long time.
> 
> The least common denominator is "classic" Bourne shell (sh).  This is
> understood by modern "full-featured" shells like bash, zsh, and *ksh.
> 
> The standard shell language is defined by POSIX.  It is based on the
> classic Bourne shell, but includes "modern" features.
> 
> BSD derivatives often use the C sh (csh or tcsh), but it has serious
> problems as a scripting language.  AFAIK the recommendation is still
> to avoid using t?csh for scripting.

Being badly in need of a life, I once researched the reasons for this.
Apparently, the BSD developers preferred csh, therefore, in FreeBSD, the
more advanced tcsh is one of the two shells available in bin (the other
being the basic sh, the Bourne shell).  tcsh has tab completion, history
with the up arrow and all that good stuff.   Other shells will be in
/usr/local/bin, so if you're stuck in single user mode, they might be
inaccessible in case of a problem.  Had they preferred Bourne style
shells, I assume ksh would be in /bin too.  :)


NetBSD has csh as the default root shell as well--to get tab completion
in it you have to add set filec in your .cshrc which will allow tab
completion--well, completion, you have to use the ESC key (there might
be a way around this, but as I prefer Bourne style shells when I didn't
find the answer in 5 minutes on google, I gave up).  :)

NetBSD also offers ksh in /bin, again one has to tweak a little to get
tab completion and history with the up arrow.  

(I have a page on NetBSD for the FreeBSD user which goes into how to do
that, at http://home.nyc.rr.com/computertaijutsu/netbsd.html if anyone
wants to save themselves a bit of googling. )

I don't think I've come across a Linux distribution that didn't have
bash as its default shell.  The only trouble with doing scripts in bash
is that it isn't the least common denominator, and has a few things that
the basic sh doesn't have, so if you're on a box that uses sh, you might
find some things don't work.  (I am not an advanced scripter, I have
found that everything I've done in bash works in ksh, however.)

Our AIX box has ksh as the default.  (For bash users who want to play
with ksh, I also have a page on stupid korn shell tricks, including a
Gentoo like prompt, which Jonathan considers a girly man one at

http://home.nyc.rr.com/computertaijutsu/ksh.html  )


Scott Robbins

PGP keyID EB3467D6
( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 D575 EB34 67D6 )
gpg --keyserver pgp.mit.edu --recv-keys EB3467D6

Xander: This is just too much. I mean, yesterday's my life like, 
uh oh, pop quiz. Today, it's rain of toads. 

Attachment: pgp00006.pgp
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links