DEV Community


Discussion on: linux : bash script conditions

moopet profile image
Ben Sinclair

You list [ STRING =~ PATTERN ] in your single-bracket conditions, but then go on to say it's different in double-bracket conditions. What did you mean?

I think the main benefit of using single-brackets is that those conditions will likely work in other shells, even if they're not as powerful.

zakiarsyad profile image
Zaki Arrozi Arsyad Author

Nice catch man, thanks.
Updated. That regex should work with double brackets [[ STRING =~ PATTERN ]]