Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jan 2002 15:36:04 -0500
From:      Jim Conner <jconner@enterit.com>
To:        "Mike Meyer" <mwm-dated-1012456142.0689af@mired.org>
Cc:        Bernie <Bernie_X@myrealbox.com>, questions@freebsd.org
Subject:   Re: shells confusion
Message-ID:  <5.1.0.14.0.20020126153501.04980750@mail.enterit.com>
In-Reply-To: <15442.17229.937600.658651@guru.mired.org>
References:  <947431@toto.iv>

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


At 23:49 01.25.2002 -0600, Mike Meyer wrote:
>Bernie <Bernie_X@myrealbox.com> types:
> > 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. However, some of the more serious problems have been fixed in the
>variants.
>
> > 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?
>
>Because csh is better for interactive use than sh.
>
> > also, why single user mode proposes /bin/sh as default?
> > is there any particular reason for it?
>
>Probably because no one has bothered to change 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.
>
>I'd agree with that, as Perl scripts often invoke commands, and one of
>the design goals was to make it easy for shell programmers to
>learn. It's not clear the latter is a *good* thing, but that's a
>different thread.
>
> > but the question is 'which shell' ...
>
>Unix shells fall into three different classes: sh and variants, csh
>and variants, and "other". As Charles pointed out, bash is by far the
>most popular shell for interactive use. It picks up most of the nice
>interactive features of csh, along with features from variants of csh
>and sh.  However, not all systems come with bash, though they all come
>with an sh variant.  An sh script should work fine in bash, but not
>necessarily the reverse, because of the extra features.
>
>Which leads to the conclusion: learn sh for scripting. It will be
>applicable on all Unix systems, and everything you learn will be
>applicable in bash, though there may be quicker or easier ways to do
>certain things.

sh is the right way to go.  In my last email I suggested ksh and I hold 
true to that.  Fortunately, if you know how to sh script, you know how to 
basicly ksh script.  I still suggest scripting in ksh, however. :)

- Jim


>         <mike
>--
>Mike Meyer <mwm@mired.org>                      http://www.mired.org/home/mwm/
>Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
>
>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+y2Y0bVsaMPXdnhbi0LAFSIkNYRhyzNWbAkeMsgA+i2k9hcnhvVwCgor7P
nflXu7xWN9aWt3RJBzqdUR0EAK/1obJFUKQSK39cKTMPQ4u2UPflbS5dJ871naG5
xBAlQAjHAXT+f/fXE2ezrSyoQnlOD4kVbPN3gB5UT5mWoylPuf5W7WmupthVzUUN
IsPDbmAT0YOwgALCfJVS+PrPCC8opmZhTjQBwgxCSY9MWULlzN3X2EEDqWIxluYb
o5W/BACgHA+aFOO5F03QZBBScWn9YBS1ZH3sSlkQEK5RiwGXLmHJacOjn660SbOE
MEKPDLDDJu/vt1fb3VRLc/fPB3aB7fi4XagfobaHbID9rx55slLhD94Q+5JuJSfg
DyJ+vVSA1k+9/SynflPl0QY5zt0xSM+0CBg9mBg2bPyuGsDwXLQ5SmltIENvbm5l
ciAoTmV3IEdQRyBLZXkgZm9yIFNuYWZ1WCkgPGpjb25uZXJAZW50ZXJpdC5jb20+
iFcEExECABcFAjxAonQFCwcKAwQDFQMCAxYCAQIXgAAKCRDmnFh04+r7ZdFiAKCh
t8Vq7ZT6qvh9Dzn0lzZXRM4gywCfSLU/H5UHX7ZoxapfDs9pLxEEZeO5Ag0EPECj
chAIAIsdwiPqW8IsumvpXu59qkfsi4H2nofxvbhMDiapEhgloydehNQOEiHwC/O1
a06PjUmNRLRdK88kjy99R84ILbWUJZUclQB2LcjlttnrIG/FzCMxoLTKOeOCJk8N
ONswBdJdcf/XqbWJBTs/MXeNf4rmShYi6WJ5+jc1IE5PXGf4SR/9bz2r+/GESlrX
tAoNtWl5a/NUxb6b0hR6zU9Y6oO1vpDDJNbcV9mafdYhsvoFYdD2c6JF+JoN+FHR
tEP3k6leYwQ5P0kuUQNgWdWNWZfBq1tQDBfhg1/AV0JBzamyJfd0prFmtUEemKx4
haDsOoT4gLSPNTqSsyDt6TNLtGMAAwUIAINeot1FVpree5bvhy3xL+Pr1UGb++DM
b8Qeer6ERkVQNx7YoU8hfpqOwvEQMyfb9s6HPfSWRUfQRF+g+9ohPgYkH+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.20020126153501.04980750>