Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jan 2002 15:29:51 -0500
From:      Jim Conner <jconner@enterit.com>
To:        Cliff Sarginson <cliff@raggedclown.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: shells confusion
Message-ID:  <5.1.0.14.0.20020126151829.02fbdc38@mail.enterit.com>
In-Reply-To: <20020126035658.GC1290@raggedclown.net>
References:  <20020126020430.P175-100000@BLAST> <20020126020430.P175-100000@BLAST>

next in thread | previous in thread | raw e-mail | index | archive | help
Below...

At 04:56 01.26.2002 +0100, Cliff Sarginson wrote:
>On Sat, Jan 26, 2002 at 02:18:16AM +0200, Bernie wrote:
> >
> > hi,
> >
> > i'm planning to learn shell programming but i'm not sure
> > on which one to choose...
> >
> > i've been reading in the 'FreeBSD unleashed' that people
> > wanting to do shell programming should stay away from
> > c-shell as it's realy good for interactive, but very bad
> > for scripts. is this true?
>
>Yes and Yes.
>
> > also, looking into the scripts in /etc, i see a line on the
> > top saying 'bin/sh'. so are they all written in 'sh' and
> > not csh ? if so, why freebsd comes with csh as default?
> >
>/bin/sh is the Unix common denominator of shells, so scripts
>get written in it. They are not written in csh, because as
>stated csh script is unusable for all practical purposes.
>
>You will be opening up another war here on the subject
>of which shell should be the default user/root shell.
>You may notice that "root" has two entries on the system,
>one as "root" with csh as it's shell, and one as "toor"
>with sh as it's shell.
>
>By the way, csh = tcsh on FreeBSD, I don't know if there
>is a "pure" csh around anymore. The huge difference between
>csh as was, and tcsh, being that tcsh is usable (ducks).
>
> > also, why single user mode proposes /bin/sh as default?
> > is there any particular reason for it?
> >
>Well it is probably true to say that most (all) Unix users
>know /bin/sh, not all of them know csh. Again it is the
>lowest common denominator I guess is the reasoning here.
>
> > i'm a bit confused on which shell to pick from programming.
> > also i've been thinking of perl, but for the moment i think
> > i've got to learn at least how to do basic shell programming,
> > not only to write programs, but also to understand scrips that
> > come with the system.
> >

OK.  This is where wars get started =P.  Therefore, I will simply state my 
opinion.

>Leave perl alone for now and learn shell programming.
>There are a few shells that are super-sets of /bin/sh, notably
>the Korn shell and the Bash shell. Bash is the one I would
>personally advise you to use. You need to install it from
>the ports first.

Perl is something you should learn once you have learned how to shell 
program, imo.  However, as for the aforementioned question of which shell 
language to learn, imo, ksh (Korn) is a much more robust language than bash 
is (strictly speaking from past experience).  But, now the question is, 
which version of ksh?  There are two notable versions.  Many are familiar 
with ksh88.  This is one that competes well with bash but ksh93 (note it 
was released in 93) seems to be much more robust than bash.  It has the 
ability to do many c-like things.  Go to http://www.kornshell.com/ and see 
for yourself (see examples).  It is said that some shops have even left 
Perl behind and have gone straight ksh93.  I don't see how that's possible, 
but whatever blows your hair back, I guess.  Anyhoo, that is my preferred 
shell language for non-interactive use.  For interactive use I prefer bash 
and I have nothing negative to say about bash.  Note, that ksh also has a 
dt (desktop) counterpart for use with motif widgets and whatnot called 
dtksh which is just a superset of ksh93.  Thats right folks, now you can 
create X shell scripts.  Quite powerful.  I am not sure if bash has the 
same thing.  Never checked.

Anyhoo, that's my `echo "$(echo "scale=2;1.00-.98" | bc)"` cents.

> > but the question is 'which shell' ...
> >
> > any advice on this matter will be appreciated.
> >
>In summary, *not* the csh for scripts.
>Learn sh for scripts.
>Use bash or tcsh for your day to day interactive use.
>
>I think most people will give you more or less the same
>advice, the choice of tcsh or bash will mostly depend on
>their personal Unix backgrounds as much as anything else.
>
>--
>Regards
>Cliff
>
>
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-questions" in the body of the message

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.6 (MingW32)
Comment: For info see http://www.gnupg.org



- Jim

Philosophy is for those who have nothing better to do than wonder
why philosophy is for those who have nothing better to do than...


mQGiBDxAonQRBACx+sz63XIeo5uTzc5n3Elf7Y13VVZGIM8Pilp3LpBu70/nGQPu
anKYDB3aa1U5cfl+cTK5lOtUxN7Fu0a2Uv0ApIlC1qA8CjDZqlu7PDETFTVrpfGZ
007BHO+y2Y0bVsaM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PgYkH+1nqH3V
PtGSw1kgLOqxZQTVPEcAMhSflt9LSJETIQQByKKh1e5RvOuApwBFmQq3syRhzqv/
j2b6t3IqAB9WR5TnoYkdUtTWM9MGubiFl5B9uH5EHWAlFF8h760U7Xp9m1J3qTyH
EJqjfGj2SP2DK5cisuWOWdPy5aSqT7ZKrcKeSTDUyiHclI1ygFHue8oO0HXqrs+k
KjFdRqIKnzfY9gW/b/6gLHhBDV6BoA9w6+1Y9egOByRcVonE8zY/xMeIRgQYEQIA
BgUCPECjcgAKCRDmnFh04+r7ZcyDAJ4ogYX7W4u8g+QJsksyL4Ld+dObCwCfU7hB
7I3ZgTsYwP6mr5RPjkH5PG8=
=QOu8
-----END PGP PUBLIC KEY BLOCK-----


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?5.1.0.14.0.20020126151829.02fbdc38>