bash How Do I Test For RegExp In Bash? Joe Bologna Read more posts by this author. Joe Bologna 10 Feb 2018 • 1 min read if [[ "$1" =~ s.* ]] then echo small elif [[ "$1" =~ l.* ]] then echo large else echo small or large fi See: Bash V3.2 Reference Manual