Bash: test for an empty variable

Today I needed to test if a bash variable was a null string. To do that you use the -z operator. To test if a variable is non-null you use the -n operator. Here is a quicky script sample I wrote to check if ushare is running, and if not start it.

if [[ -z $(pidof ushare)]]; then
    ushare --content /home/share/ --name Basement --daemon
fi


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 18.188.205.95
To prevent spam please submit by clicking the kitten: