How standard is "shift n" in sh(1)?

Paul Leyland pcl at robots.ox.ac.uk
Fri Mar 8 20:47:11 AEST 1991


The following query arose here when a shell script was found to
execute differently on a Sun and a Convex.

Under SunOS 4.0 sh(1), the shift operator can take an optional
numerical parameter (default 1), which specifies how many arguments
are to be shifted away.

On the Convex, any argument is silently ignored and a single shift
performed.

Clearly, omitting the argument is safe on both architectures and has
the same behaviour, so this is the (presently) correct way to write
scripts.

The question is: which is the _de facto_ "standard" behaviour?
Should we be asking Convex to come into line, or should we flag Sun's
action as unportable?



More information about the Comp.unix.questions mailing list