bug-bash
[Top][All Lists]
Advanced

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

Re: Undocumented behaviour - parameter expansion ${par-word}


From: Jan Schampera
Subject: Re: Undocumented behaviour - parameter expansion ${par-word}
Date: Tue, 04 Sep 2012 13:28:56 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20120724 Iceowl/1.0b1 Icedove/3.0.11

On 04.09.2012 13:13, Roman Rakus wrote:
Hi,
Petr, adding to cc: list, found behaviour not documented, neither in man
page nor bash ref manual:
${par-word} will do expansion of par, and if the par is unset it is
substituted by word. It is different from ${par:-word}, where word is
used when par is unset or null.

Is it undocumented and deprecated, like $[]? Or just undocumented?

Hi Roman,

it actually is documented (and it's more general, not limited to "-")

[...]
When not performing substring expansion, using the forms documented below, bash tests for a parameter that is unset or null. Omitting the colon results in a test only for a parameter that is unset.
[...]

--
Be conservative in what you do, be liberal in what you accept from others.
- jbp, master of the net, in RFC793




reply via email to

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