Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jan 2002 10:11:02 -0600
From:      "Bob Giesen" <BobGiesen@earthlink.net>
To:        "Bernie" <Bernie_X@myrealbox.com>, "freebsd-questions" <freebsd-questions@FreeBSD.org>
Subject:   Re: shells confusion
Message-ID:  <004301c1a684$0de9bb00$ab41d03f@pegasus>
References:  <20020126020430.P175-100000@BLAST>

next in thread | previous in thread | raw e-mail | index | archive | help
   For scripting, the most logical choice to learn first is the Bourne shell
(/bin/sh on most systems).  As you've noted, the vast majority of existing
scripts that are supplied with systems are written in Bourne, so you will
have little trouble translating what you learn to all those examples that
you have available to you.  Also, should you desire to modify any of those
scripts, you will be less likely to break them through syntax errors.
(Notice the "#!/bin/sh" at the tops of those scripts?  The leading "#!"
tells the invoking shell to run the script in a subshell of the following
command (/bin/sh, in this case).  So, if you were to insert something from
ksh (Korn Shell), e.g., that /bin/sh doesn't understand, the script will
fail.)
   Once you're comfortable with sh, you'll want to consider looking at the
other shells -- especially if you work at the command line a lot and/or do a
lot of scripting.  Most other popular UNIX command shells (ksh, bash, zsh)
are mostly supersets of the Bourne shell, so you will find it very easy to
take advantage of their extended features after you've learned Bourne.  It
is a natural progression.  However, should you learn one of those whiz-bang
shells, first, you may find dealing with Bourne-shell scripts a bit more
frustrating when you find that you have to take into account its
limitations.

----- Original Message -----
From: "Bernie" <Bernie_X@myrealbox.com>
To: <freebsd-questions@FreeBSD.ORG>
Sent: Friday, January 25, 2002 6:18 PM
Subject: shells confusion


>
> 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?
>
> 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?
>
> also, why single user mode proposes /bin/sh as default?
> is there any particular reason for it?
>
> 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.
>
> but the question is 'which shell' ...
>
> any advice on this matter will be appreciated.
>
>
> Regards
>
> --Bernie
>
>
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message


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?004301c1a684$0de9bb00$ab41d03f>