Created
April 6, 2020 20:23
-
-
Save kesor/6aa246d08c2aa2c3b0cfe1fb769e2c51 to your computer and use it in GitHub Desktop.
Remove all the Python files and replace them with a tiny shell script
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/sh | |
just_the_file_please() { | |
sed -e 's!^[^/]*\(/.*\)$!\1!' | |
} | |
remove_magic() { | |
sed -e 's!__pycache__/!!; s!\.[^.]*\.pyc$!.pyc!' | |
} | |
python -m compileall -f . | |
find /app/scapy -type f -name \*.py -exec rm \{\} \+ | |
find /app/scapy -type f -name \*.pyc -ls \ | |
| just_the_file_please | \ | |
while read before_just_a_file; do | |
after_just_a_file=$(echo $before_just_a_file | remove_magic) | |
mv $before_just_a_file $after_just_a_file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing sir . :)