*BSD News Article 67084


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!metro!metro!asstdc.scgt.oz.au!nsw.news.telstra.net!act.news.telstra.net!vic.news.telstra.net!news.mira.net.au!inquo!in-news.erinet.com!bug.rahul.net!rahul.net!a2i!samba.rahul.net!rahul.net!a2i!sierra.net!imci5!imci4!newsfeed.internetmci.com!newshub.csu.net!usc!howland.reston.ans.net!EU.net!Germany.EU.net!zib-berlin.de!news.tu-chemnitz.de!irz401!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Some questions ...
Date: 27 Apr 1996 09:12:42 GMT
Organization: Private FreeBSD site, Dresden
Lines: 82
Message-ID: <4lsoea$89n@uriah.heep.sax.de>
References: <nC4752813@longacre.demon.co.uk>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

searle@longacre.demon.co.uk (Michael Searle) writes:

I can't answer all of your questions, but will try this one:

>I am a new FreeBSD user (1 week), also new to Unix and PCs. I know that
>there are several different shells used with FreeBSD, but not which I should
>be using. At the moment I am using csh, although most scripts that I have
>seen use sh, but there are also sh, bash, zsh, tcsh and probably others on
>the CD. Or does it depend on what I am going to do?

There are basically two different `lines' of shells.  The first is the
``Bourne shell'' line, with:

. sh	traditionally the Bourne shell, normally the standard shell
	on all Unices; for *BSD, it has been replaced by a freeware
	version based on Kenneth Almquist's (sp?) `ash', but heavily
	moved towards Posix (and therefore, towards Korn shell).

. ksh	the Korn shell, where the original version is legally encumbered
	and can therefore only be found in USL-derived (SysV) systems.
	The Posix standardized shell heavily smells like ksh (and where
	ksh was too idiosyncrasic, its features have been marked
	``implementation-defined'' in the standard).  There's a freeware
	reimplementation that resembles the Korn shell rather well.

. bash	GNU's ``Bourne-again shell'', functionally basically equivalent
	with the ksh, suffers from feeping featurism however, and is
	admittedly rather bloated.

. zsh	from my understanding, about the same in function as the freeware
	ksh.

Back in the days of early BSD, Bill Joy (later a co-founder of Sun
Microsystems) created the C-Shell.  It was featured towards a more
C-like scripting language and contains some useful features for
interactive work.  In particular, it's been the first shell that had a
command-line history (though it's ^!$: usage seems to be scarey these
days ;).  There are two versions around:

. csh	plain csh, like `sh' it's available on almost any Unix system
	around, so if you know how to work with all the !^$: stuff,
	you get history substitution capabilities even on the dumbest
	terminal (or even a plain typewriter :) in the world, unlike
	with most /bin/sh's.  It now also has the ability of filename
	completion (using the <ESC> and ^D keys, you must set the
	`filec' internal variable).  bash and tcsh (perhaps also zsh)
	do also have this, at least The True And Only Posix Korn Shell
	still doesn't provide this useful feature.

	csh as a scripting language is dead for various reasons, but
	this doesn't affect its usefulness for an interactive shell.

. tcsh	the successor of csh, inherited all the features of csh, as
	all of the other modern shells, its history can be browsed
	using the arrow keys (without further setup -- works ``out of
	the box'' once your TERM variable is set correctly), and it
	comes with all the whistles and bells like bash.  Of course ;),
	this makes it as bloated as bash, and is certainly the bash
	counterpart for csh freaks (like me :).

The choice of your interactive shell is most likely a religous topic,
so i'm not going to recommend you any.  You should know that BSD's
/bin/sh does have command-line editing features that can be enabled by
``set -o emacs'' or ``set -o vi'', where the emacs flavour even gives
you arrow-key functions ``as one would expect them'', much unlike the
original Korn shell has.

For scripts, /bin/sh is the shell of the choice.  Using other shells
for them is an outcry for going incompatible with other systems
around.  If /bin/sh's scripting features don't suffice your needs,
better make a deep cut and chose a better _scripting language_ (like
Perl or tcl), but not yet another incompatible shell flavour.

Final hint: the shell of your `root' user should be statically
linked and reside under /bin.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)