=~ in
[ ]. Use [..](..) instead.[ "$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.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.