help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Brace expansion with empty args


From: Pierre Gaston
Subject: Re: [Help-bash] Brace expansion with empty args
Date: Wed, 12 Jun 2013 11:13:43 +0300

On Wed, Jun 12, 2013 at 5:39 AM, 齋藤正樹 <address@hidden> wrote:
> Hi, all.
> I have a question about brace expansion.
>
> ~$ echo a{b,c}
> ab ac
> ~$ echo a{,c}
> a ac
> ~$ echo a{,}
> a a
> ~$ echo {'',c}
>  c
> ~$
>
> OK, two words were generated.
>
> ~$ echo {,c}
> c
> ~$ echo {,}
>
> ~$
>
> I expected two words.
> But I got only one or zero words.
> Is this behavior intended?
> Or documented in anywhere?
>
> I tested on 4.2.0(1)-release and 4.1.2(1)-release.
>
> Regards.
>

{,} just expands to two unquoted nothing and results in nothing
if you quote the nothing you get 2 empty strings:

$ set ''{,};echo $#
2



reply via email to

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