Created
June 13, 2018 13:00
-
-
Save ktomk/b2442a94a3f080ca05539b2fbc5ef914 to your computer and use it in GitHub Desktop.
Revisions
-
ktomk created this gist
Jun 13, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #!/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