Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Feb 2001 06:59:14 -0800
From:      richard childers <fscked@pacbell.net>
To:        igorr@crosswinds.net
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: OT: Which programming shell, sh or csh?
Message-ID:  <3A9A6F42.3BAC88A2@pacbell.net>
References:  <Pine.BSF.4.21.0102231016020.3063-100000@www.bellnetworks.net> <20010223153105.A17466@tethys.valhalla.net> <20010226093957.A1988@linux.rainbow>

next in thread | previous in thread | raw e-mail | index | archive | help
The issues are as follows (roughly).

/bin/sh is the oldest piece of code, hence, the most reliable. It is also the
smallest, in terms of executable size, and in olden days this was considered
important.

/bin/csh is the second oldest piece of code and it has lots of things that
/bin/sh forgot. Alas, in the frenzy to create a friendly interface,
programming functionality was left out; shocking, but true, /bin/sh has the
ability to define reusable functions and pass parameters to these functions
and /bin/csh does not. What kinda C shell is that, you ask? You're not the
first.

There are several other shells which have in various ways attempted to
ameliorate the situation; HP and POSIX have blessed the Bourne shell, but
with a few changes, so that it is now the POSIX shell. The Bourne-Again Shell
(bash) attempts to enrich the user interface while preserving the command
syntax of /bin/sh. Et caetera.

I would in general recommend /bin/sh - note that all boot scripts are written
in /bin/sh.

But I, too, do a lot of my quick-and-dirty scripting in csh ...


-- richard


Igor Robul wrote:

> On Fri, Feb 23, 2001 at 03:31:05PM +0000, Mark Drayton wrote:
> > > I am writing some small scripts for our users to help them interact
> > > with cvs. I have looked at using either sh or csh, but I cannot find
> > > any information as to why I would choose one over the other.
> >
> > I've never used csh myself, but I've read several documents saying it
> > shouldn't be used. See Tom Christiansen's article for more info:
> Most of _my own_ scripts are written in csh. But generally, sh is
> better for programming than csh.
>
> --
> Igor Robul, Unix System Administrator & Programmer @ sanatorium "Raduga",
> Sochi, Russia
> http://www.brainbench.com/transcript.jsp?pid=304744
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

--
Richard A. Childers
Senor UNIX Administrator
fscked@pacbell.net (email)
203.556.8471 (voice/msgs)

# Providing administrative expertise (not 'damage control') since 1986.
# PGP fingerprint: 7EFF 164A E878 7B04 8E9F  32B6 72C2 D8A2 582C 4AFA



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A9A6F42.3BAC88A2>