[Top][All Lists]

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

${param+x} ?

From: lacsaP Patatetom
Subject: ${param+x} ?
Date: Tue, 19 Dec 2023 11:38:50 +0100


this form `${param+x}` is not documented (man) but is accepted by bash and
differs from `${param:+x}` :
`unset p; echo -n ${param+x} && echo -n ${param:+y}` return nothing,
`p=''; echo -n ${param+x} && echo -n ${param:+y}` return `x` and
`p='test'; echo -n ${param+x} && echo -n ${param:+y}` return `xy`

is it possible to get an explanation ?

it is found in a script in this test :
[ -z ${param+x} ]

what's the point of this test, which will always be true ?

regards, lacsaP.

reply via email to

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