What does +x mean in the below statement?
if[ -z ${FSV_ROOT+x} ]
Read up on Use Alternative Value. See 2.6.2 Parameter Expansion.
In parameter expansion, if a parameter is unset or null, null shall be substituted; otherwise, the expansion of word shall be substituted. Use of the colon in the format shall result in a test for a parameter that is unset or null; omission of the colon shall result in a test for a parameter that is only unset.
So in your case:
If FSV_ROOT is set and not null, substitute x
If FSV_ROOT set but null, substitute x
If FSV_ROOT is unset, substitute null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With