Rainer Weikusat wrote:
> # termination condition: called w/ no argumnets,
> # ergo, nothing to do, return success
> test "$1" || return 0
Nit-pick: the comment doesn't match the code. Should be either:
# termination condition: called w/ no arguments,
# ergo, nothing to do, return success
test "$#" -eq 0 || return 0
or:
# termination condition: called w/ no arguments or with an
# empty first argument, ergo, nothing to do, return success
test "$1" || return 0
In the latter case I would also usually use test -n "$1" just in
case it ever gets run with a version of test that doesn't follow
the POSIX single-argument rule correctly. (I believe pre-POSIX
Bourne shells when given test "!" would produce an error complaining
of a missing argument.)
--
Geoff Clare <
net...@gclare.org.uk>