Bash double bracket regex comparison using negative lookahead error return 2
问题 On Bash 4.1 machine, I'm trying to use " double bracket " [[ expression ]] to do REGEX comparison using " NEGATIVE LOOKAHEAD ". I did " set +H " to disable BASH variable' ! ' expansion to command history search. I want to match to " any string " except " arm-trusted-firmware ". set +H if [[ alsa =~ ^(?!arm-trusted-firmware).* ]]; then echo MATCH; else echo "NOT MATCH"; fi I expect this to print "MATCH" back, but it prints "NOT MATCH". After looking into the return code of "double bracket", it