The example you got from aia did not have a parenthesis in it
# yours
if( ! $var >>> =~ <<<
# note spaces are needed on BOTH sides of any of these: [ ] [[ ]]
# because they are keywords bash like if or read
# should be:
if [ ! $var
awk is definitely not needed. Depending on your bash version, Aia's proposal (type in as presented!) should work satisfyingly.
If it doesn't, pls. post your bash versions, the script you tried to run, error messages verbatim, and an execution log (set -x option).
the /pattern goes here/ thing delimits a regular expression pattern, which is what you are using. It works with the ~ character instead of the = character.
If you change anything else, please give more of your code to work with.