Bash: test for undefined variable August 01, 2007 bash echo -n “myvar=${myvar:-notset}” If myvar is null or unset then it will be set to “notset”.