# Bash compare strings if [ "$x" = "valid" ]; then echo "x has the value 'valid'" fi if [ "$x" != "valid" ]; then echo "x has the value 'valid'" fi