Op zaterdag 17 augustus 2024 00:29:23 CEST schreef u: > On Fri, Aug 16, 2024, at 12:59 PM, freek--- via Bug reports for the GNU > There is no problem with "$@" or functions here. The "problem" is > that "$@" expands to multiple fields when there are two or more > positional parameters, so (as the error message says) you end up > running test(1) with too many arguments. This is a usage error. > > $ set -x a b c d > $ test -n "$@" > + test -n a b c d > bash: test: too many arguments > Apparently I have a problem with the concept of $@, I see it as list of zero or more non-whitespaced elements, and quotes around it makes it into a single element. Like a parameter p with a content of zero or more non-whitespaced elements, where the quotes make in into a single element.
Thanks for teaching me this concept. It must have some meaning in more complicated situations. A test -n "$1" has also the effect I was looking for as the suggested one $# -ne 0 . -- fr.gr. Freek de Kruijf