STRING1 =~ STRING2 (conditional operator)
true if the value on the left matches the regular expression on the right.
=~ is not included in POSIX.
Avoid it if you want to stay compatible with POSIX shells.
Links
Examples
- Different ways to test if a string matches a regular expression:
1 2# Bash [[ $name =~ J[au]ne ]] && echo "it's Jane or June!"
BashSupport Pro ist eine Bash IDE mit Unterstützung für =~ – probieren Sie es aus!