-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC2074
koalaman edited this page Jun 27, 2017
·
1 revision
[ "$input" =~ DOC[0-9]*\.txt ] && echo "match"
[[ "$input" =~ DOC[0-9]*\.txt ]] && echo "match"
=~
only works in [[ .. ]]
tests. It does not work with test
or [
in any shell.
If you're targeting POSIX sh
, rewrite in terms of case
or grep
instead.
None.