bug-bash
[Top][All Lists]
Advanced

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

Re: "${x-"$@"}" expansion


From: Piotr Grzybowski
Subject: Re: "${x-"$@"}" expansion
Date: Wed, 27 Apr 2016 10:54:10 +0200

On 26 Apr 2016, at 21:03, Grisha Levit wrote:

> This behavior seems very strange.  This example is with $@ but it seems the 
> same for address@hidden
> 
> The manual says for ${parameter:-word}:
> 
> > If parameter is unset or null, the expansion of word is substituted.
> 
> In this case, $@ is expanded as if it was quoted (even if 'word' is not 
> quoted) and the outer quotes do no serve to quote the expansion of 
> address@hidden
> 
> $ set -- '1 1' '2 2'; unset x
> $ v=( "address@hidden" ); declare -p v
> declare -a v=([0]="1 1" [1]="2 2")

 I gather, you expect $* behavior?

#set -- '1 1' '2 2'; unset x
#v=( "${x-$*}" ); declare -p v
declare -a v='([0]="1 1 2 2")'

cheers,
pg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]