Re: printf %q represents null argument as empty string.
From:
Chet Ramey
Subject:
Re: printf %q represents null argument as empty string.
Date:
Sat, 12 Jan 2013 14:40:35 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0
On 1/12/13 9:48 AM, John Kearney wrote:
> anyway now we have a point I disagree that
> "${@}"
>
> should expand to 0 or more words, from the documentation it should be 1
> or more. At least that is how I read that paragragh. IT says it will
> split the word not make the word vanish.
> so I had to test and it really does how weird, is that in the posix spec?.
Yes. Here's the relevant sentence from the man page description of $@:
When there are no positional parameters, "$@" and $@ expand to
nothing (i.e., they are removed).
Posix says something similar:
If there are no positional parameters, the expansion of '@' shall
generate zero fields, even when '@' is double-quoted.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/