What does ${ARGUMENT+x} mean in Bash? [duplicate]

It means that if $ARGUMENT is set, it will be replaced by the string x

Let’s try in a shell :

$ echo  ${ARGUMENT+x}

$ ARGUMENT=123
$ echo  ${ARGUMENT+x}
x

You can write this with this form too :

${ARGUMENT:+x}

It have a special meaning with :, it test that variable is empty or unset

Check bash parameter expansion

Leave a Comment