Consider:
keith@T500:~$ q=$(ls | grep dEsktop) (i.e. a non-existent file)
keith@T500:~$ echo $q
keith@T500:~$
I want to test the value of “q” for its null value here. It’s not " " or “”, so what might it be?
Can anyone help?
Consider:
keith@T500:~$ q=$(ls | grep dEsktop) (i.e. a non-existent file)
keith@T500:~$ echo $q
keith@T500:~$
I want to test the value of “q” for its null value here. It’s not " " or “”, so what might it be?
Can anyone help?
Found it at: scripting - How to determine if a bash variable is empty? - Server Fault
For a variable q:
if [ -z “$q” ]; then …
will detect if the variable is unset or the empty string “”.