fixes for bash's handling of regular expressions in if statements