Changed if =~ for bash 3.1 support