In a bash script, I stumbled upon this piece of code:
opts=${1:+--host $1}
/path/somecmd $opts somesubcmd
By testing, I found out that $opts
expands to --host $1
whatever $1
is.
I wonder what is the purpose of this syntax.
Why not simply use opts="--host $1"
?
Is it a specific way to pass options to a command ?