Talk:Bourne shell
From Wikipedia, the free encyclopedia
Hi, I can see the same errors on that page as on the one about "Unix shell".
The Bourne shell is generally no longer located as /bin/sh. It is only the case on some very rare systems (like Solaris cited above). Many systems don't have a Bourne shell at all anymore, and when they have one, it's generally either in a non standard place such as /usr/old/bin or has a different name such as bsh or sh.bourne. The sh code wasn't made free until very recently. That's why no Free Unix system ever had it (exception of early BSDs which was the cause of law suites, BSDs then adopted the Almquist shell which was a free reimplementation of the Bourne shell as it could be found on SysV with some extensions and has now been made POSIX (modern sh) conformant).
Many scripts are still written in a Bourne compatible syntax, but just because it is the greatest common denominator of the shs of the past and current Unices. sh is often confused with the Bourne shell because sh has been the Bourne shell on many systems for a long period of time.
So it's no longer a popular default shell either, nor is it the default login shell for root on many operating systems. sh is though.
And it's wrong to say it's standard on all commercial Unices.
See my comments on the Unix shell page for details.
Another error:
"for loops, in particular the use of $* to loop over arguments". That's incorrect. $* is the concatenation of the positional parameters. It's $@ when double quoted that allows to loop over the positional parameters, not $*. And "for" loops over the positional parameters by default, so there's no need to specify "$@":
for i do whatever "$i" done
(it's not for do od, but for do done in the Bourne shell)
I don't know if one can say that the Korn shell was written "much later" than csh. I believe it was started in the early eighties (read 1982 somewhere) so only 3 years after csh (I might be wrong on that one).
- re: Bourne shell usage.
- Dates and version numbers may be hard to find. I suspect there was a also divergence as various vendors quickly patched and enhanced the original shell, without sharing these source changes(?) (sh was an "open system", but not "open source"). I know of one DB vendor actually included their standard shell in their DB distribution so as to avoid any unexpected enhancements from the OS vendors. c.f. Talk:Unix shell#Shells listed by compatibility. Would a Timeline of Bourne shell enhancements & clones be an overkill?
- Re:
while ~ do ~ od
- Your comment is clearly correct. As
/bin/od
would have predated the Bourne shell syntax, andwhile ~ do ~ done
is correct. I can fix this right away. Are there any historical citations on whydone
as used? The Bourne's originalmac.h
file uses both, eg.
FOR ~ DO ~ OD # for loop # WHILE cond DO ~ OD # early termination loop # REP ~ PER cond DONE # late termination loop # LOOP ~ POOL # infinite loop #
- Re:
$*
vs"$@"
- Makes me wonder if Bourne built in
$@
originally, or it was added as an enhancement. I see a lot of $* in code even today that should be "$@". Was "$@" apart of the original design, or an enhancement? Need to check the original source tree somehow... I wonder if is still compiles... :-) (BTW IIRC csh used $*:q for "$@") --NevilleDNZ 12:48, 10 September 2006 (UTC)
-
- I wouldn't say it was over-kill, but it sounds like it would be difficult to research and cite, since most of those changes are by definition closed and binary. -- Gwern (contribs) 22:47, 10 September 2006 (UTC)