YETUS-854. shellcheck is picking up extra files

Signed-off-by: Allen Wittenauer <aw@apache.org>
diff --git a/precommit/src/main/shell/test-patch.d/shellcheck.sh b/precommit/src/main/shell/test-patch.d/shellcheck.sh
index b5d7855..099380b 100755
--- a/precommit/src/main/shell/test-patch.d/shellcheck.sh
+++ b/precommit/src/main/shell/test-patch.d/shellcheck.sh
@@ -44,8 +44,8 @@
     add_test shellcheck
     yetus_add_array_element SHELLCHECK_FILTERFILES "${filename}"
   elif [[ ! ${filename} =~ \. ]]; then
-    # if it doesn't have an extension, then assume it is and
-    # we'll deal with it later
+    # if it doesn't have an extension then assume it is
+    # and the plugin will sort it out
     add_test shellcheck
     yetus_add_array_element SHELLCHECK_FILTERFILES "${filename}"
   fi
@@ -107,14 +107,14 @@
 
   text=$(head -n 1 "${fn}")
 
-  # shell check requires either a bangpath or a shell check directive
-  # on the first line.  so check for a leading comment char
-  # and some sort of reference to 'sh'
-  if echo "${text}" | "${GREP}" -E -q "^#"; then
-    if echo "${text}" | "${GREP}" -q sh; then
-      yetus_add_array_element SHELLCHECK_CHECKFILES "${fn}"
-      yetus_debug "Shellcheck added: ${fn}"
-    fi
+  # shell check requires either a bangpath or a shellcheck directive
+  # on the first line.
+  if [[ "${text}" =~ ^\#! ]] && [[ "${text}" =~ sh ]]; then
+    yetus_add_array_element SHELLCHECK_CHECKFILES "${fn}"
+    yetus_debug "Shellcheck added: ${fn}"
+  elif [[ "${text}" =~ shellcheck ]]; then
+    yetus_add_array_element SHELLCHECK_CHECKFILES "${fn}"
+    yetus_debug "Shellcheck added: ${fn}"
   fi
 }