My goal is to add an argument to a program being executed if a bash variable is existent, as so:
bob -a some_arg (( if we have ${VAR} defined add '-b ${VAR}' as an argument ))
I’d like to avoid something like:
if [[ -z ${VAR} ]]; then
bob -a some_arg
else
bob -a some_arg -b ${VAR}
fi
Although, it is the only option?
Using bash parameter expansion :
Some good doc : http://wiki.bash-hackers.org/syntax/pe
And also `LESS=+/’Parameter Expansion’ man bash