How do I use regular expressions in bash scripts ?
Use regular expressions in bash scripts It changed between bash 3.1 and bash 3.2:
Terse description of the new features added to bash-3.2 as the release of bash-3.1.
Quoting the string argument to the [[ command’s =~ operator now forces string matching, as with the other pattern-matching operators.
Use below code for without the quotes:
i="test" if [[ $i =~ 200 ]] ; then echo "OK" else echo "not OK" fi
Regex is a very powerful tool that is available at our disposal & best thing about using regex is that they can be used in almost every computer language. So if you are Bash Scripting or creating a Python program, we can use regex or we can also write a single line search query.