Title: Bourne/bash shell scripts: string comparison Post by: Mark David on March 16, 2007, 01:32:09 PM Bourne/bash shell scripts: string comparison
To determine if the value of a variable ($var) is empty (null): Code: if [ $var == "" ] To determine if the value of a variable is not empty: Code: if [ $var != "" ] To compare the contents of a variable to a fixed string: Code: if [ $var == "value" ] To determine if variable's contents are not equal to a fixed string: Code: if [ $var != "value" ] |