bash: Variable substitution - Use word if variable name set otherwise use nothing.
-
Take into account the main readme for this section. README first.
Syntax is:
${name+word}if the variable $name is set, then substitute word otherwise use nothing.
Here Brazil is set, has a value of SugarCane
$ Brazil=SugarCane $ Amazon=${Brazil+NoDeforestation} $ echo $Amazon NoDeforestation
Now change Brazil to Brazil1 and try again
$ Amazon=${Brazil1+NoDeforestation} $ echo $Amazon $
© Lightnetics 2024