Skip site navigation (1)Skip section navigation (2)
Date:      26 Jan 2002 14:39:49 -0800
From:      swear@blarg.net (Gary W. Swearingen)
To:        "Bob Giesen" <BobGiesen@earthlink.net>
Cc:        "freebsd-questions" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: shells confusion
Message-ID:  <jgofjg68ju.fjg@localhost.localdomain>
In-Reply-To: <004301c1a684$0de9bb00$ab41d03f@pegasus>
References:  <20020126020430.P175-100000@BLAST> <004301c1a684$0de9bb00$ab41d03f@pegasus>

next in thread | previous in thread | raw e-mail | index | archive | help
"Bob Giesen" <BobGiesen@earthlink.net> writes:

> [...]  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.

Our newbie should also know that "Bourne shell" has no one definition.
I'm not sure of the history of the term, but I seem to remember that
Mr. Bourne wrote the first one about 25 years ago and at some point
AT&T choose it for most of their scripts and developed the official
version until I don't know when. (They later switched to KSH, IIRC.)
The various non-BSD Unixes (and later the BSDs) all developed their
own "sh" programs that had many features in common with the AT&T
version and some differences.  Eventually (1992?), POSIX came up with
a sort of minimal definition which allowed variants.  Probably all
shells today attempt to follow to a high degree, usually with a POSIX
flag which tries harder to follow the rules, but which few use.  I
suspect that widely-compatible "sh" scripts these days go beyond both
old "sh" scripts and POSIX, but I don't know for sure.

It shouldn't be hard to find more reliable history with a WWW searcher.

But FreeBSD's "sh" (or any other, I suppose) has many features that go
beyond old-fashioned Bourne shell and POSIX.  I have no reason to
believe that the FreeBSD "sh" is anymore compatible with most other
systems's "sh" scripts than "ksh", "bash", or true Unix "sh" variants
(with or without POSIX flags set), except that the FreeBSD "sh" man page
doesn't discuss POSIX issues much (but that might be just a
documentation issue.)   It does have many FEWER advanced features,
though, so I do agree with the above quote.

Finally, I know that some people choose to support non-GPL software when
it's not a great sacrifice, which rules out "bash" for some.  After
dropping GNU/Linux, I choose "pdksh" so I could later easily carry it's
peculiarities with me between OSes instead of learning those of
FreeBSD's "sh" (though maybe it's as portable as "pdksh").  It works
well interactively and seems to well-support the writing of broadly-
compatible "sh" scripts (when you don't use the documented ksh-only
stuff that you reserve for the command line).

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?jgofjg68ju.fjg>