Posts Tagged ‘shell’

Bash: test for undefined variable

Wednesday, August 1st, 2007

echo -n “myvar=${myvar:-notset}”

If myvar is null or unset then it will be set to “notset”.