Skip to content

Instantly share code, notes, and snippets.

@mattolenik
Created May 23, 2018 01:36
Show Gist options
  • Save mattolenik/70ae24cfd5898a093e8dcb87eee6a3cb to your computer and use it in GitHub Desktop.
Save mattolenik/70ae24cfd5898a093e8dcb87eee6a3cb to your computer and use it in GitHub Desktop.
Recursively find shell scripts by detecting shebang
# Caveat: grep can't match the beginning of the file, so this will catch files with a shebang on any line,
# such as a script being embedded in another kind of file. To get around this each file should be checked with head -n1
grep -Ir '^#!/.*sh' --exclude-dir 'node_modules' --exclude '*.tpl' ./* | awk -F: '{print $1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment