Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src



Module Name:    src
Committed By:   kre
Date:           Sat Sep 21 20:48:51 UTC 2024

Modified Files:
        src/bin/sh: options.c sh.1
        src/tests/bin/sh: t_shift.sh

Log Message:
In !TINYPROG versions of sh, make the builtin "shift" builtin command
perform a rotate instead or shift if given a numeric arg (which is
otherwise an error).

"set -- a b c; shift -1; echo $*" will echo "c a b".

While here, make the shift builtin comply with POSIX, and accept
(and ignore) a '--' arg before the shift (or rotate) count.

Document the variant of shift in sh(1)

Adapt the shell test for shift to not expect "shift -1" to be an
error, test that rotate works as expected, and include some tests
that use the (useless, but required) "--" arg.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/bin/sh/options.c
cvs rdiff -u -r1.263 -r1.264 src/bin/sh/sh.1
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/sh/t_shift.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index