Created
June 13, 2018 13:00
-
-
Save ktomk/b2442a94a3f080ca05539b2fbc5ef914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# de-execute all executable files that are either zero width or don't have a shebang (Magic Line) | |
# | |
# note: no explicit non-binary check ( -not -exec grep -vIq . "{}" \; ) | |
# | |
echo -n "before: "; find . \( -name '.git' -o -name 'bin' \) -prune -o -type f -executable -print | wc -l | |
find . \( -name '.git' -o -name 'bin' \) -prune -o -type f -executable \ | |
\( -size 0 -o -exec /bin/bash -c 'head -n 1 {} | grep -vq ^#!' \; \) -exec chmod -x {} \; | |
echo -n "after: "; find . \( -name '.git' -o -name 'bin' \) -prune -o -type f -executable -print | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment