Change a bit if a variable defined 

In short, use the "check set" feature.

I have always want this feature. If a varible is defined, I want to use it, with a little bit of twisting. Else, if it is not defined, leave empty.

${ parameter :+ word }

If parameter is set and is non-null, substitute word; otherwise substitute nothing.

$ echo =$test_var=
==
$ echo =${test_var:-asdf}=
=asdf=
$ echo =${test_var:+asdf}=
==
$ test_var=T
$ echo =${test_var:+asdf}=
=asdf=
$ echo =${test_var:+pre-$test_var.post}=
=pre-T.post=