| set -e
| tty defs
| tty chars
| using siginfo
| line charset
Functions and positional parameters: SVR2 vs SVR3 ff.
The SVR2 variant of the Bourne shell introduced functions.
It was documented that:
[...] The positional parameters $1, $2, .... are set to the
arguments of the function.
So this behaviour
- is not a bug,
- and it's consistent, because functions modify
the global environment also in any other aspect:
- current working directory
- error flag ("set -e")
- further function definitions
However, this behaviour is not intuitive when having background
in other programming languages.
The behaviour was changed with the following SVR3 variant.
The decisions how to go on with SVR2 based shells were different now:
- HP-UX always kept the SVR2 based shell
and they never changed this behaviour.
Instead they added a note to the
section of the manpage.
- OFS1 always kept the SVR2 variant, too,
but they did change the behaviour.
Interestingly, they wrongly still document the old
behaviour until today.
- In Version 8, the SVR2 variant was taken as code base for numerous
further changes, mainly aiming towards a cleaner and more
consistent design - and probably for this reason the behaviour
of functions was not changed here.
There's also a thread with numerous different points of view on
the issue, see
<316526A3.firstname.lastname@example.org> and ff., 04/96
comp.unix.shell, comp.sys.hp.hpux, comp.sys.hp.apps,