Finding the last arg

Chet Ramey chet at odin.INS.CWRU.Edu
Thu Jan 3 04:41:57 AEST 1991


>>In fact, they need to be BSD bourne shell
>>scripts rather that ATT Bourne shell scripts.  The difference is probably
>>significant here, because of the differences in the way these two Bourne
>
>  As an aside, could you explain this comment?  I have had minimal contact
>  with BSD, but my experience does not seem to support this statement.

The BSD /bin/sh is the one from v7, with minimal changes for the 4.2 BSD
signal semantics (restarted system calls, etc.) and # as a comment
character.  The AT&T /bin/sh changed drastically beginning with System V.2,
and further changes appeared in System V.3. 

Here's a short list of what was added to the v7 sh for the System V.2 sh:

shell functions and the `return' builtin
redirection of input/output for builtins (e.g. `read x < /dev/tty')
command hashing, `set -h', and the hash builtin
test/[, echo, pwd, ulimit builtins
exit status of a pipeline was defined to be the exit status of the last command
set -a, set -f
# as the comment character (this was put in at Berkeley and adopted by AT&T)
colon form of parameter substitution to test for nullness of a variable
CDPATH
MAILCHECK, MAILPATH
the use of `!' to negate a [] pattern for filename generation
the `<<-' form of here-document redirection (strip leading tabs)
set --
numeric parameter to the shift builtin
the unset builtin (!)
restricted shell mode

There were a few changes between the System V.2 sh and the V.3 sh, in
addition to bug fixes:

the shell is now 8-bit clean (that is, the shell no longer implements quoting
by turning on the 8th bit of characters)
function arguments no longer overwrite the global set of positional parameters
the getopts builtin

The BSD /bin/sh, which is still pretty much the V7 /bin/sh, includes
`login' as a builtin and allows `chdir' as a synonym for `cd'.  The
System V shell includes `newgrp' as a builtin.  As of 4.3 BSD, the BSD sh
accepts # as a comment only when non-interactive.

Chet
-- 
Chet Ramey				``I die, Horatio''
Network Services Group, Case Western Reserve University
chet at ins.CWRU.Edu
                My opinions are just those, and mine alone.



More information about the Comp.unix.shell mailing list