2014-05-21 21:17:45 +00:00
|
|
|
# Sebastian Raschka 05/21/2014
|
|
|
|
# Shell script that prepends a Python shebang
|
|
|
|
# `!#/usr/bin/python` to all
|
|
|
|
# Python script files in the current directory
|
|
|
|
# so that script files can be executed via
|
|
|
|
# >> myscript.py
|
|
|
|
# instead of
|
|
|
|
# >> python myscript.py
|
|
|
|
|
2014-05-21 21:26:28 +00:00
|
|
|
# prepends !#/usr/bin/python to all .py files
|
2014-05-21 21:17:45 +00:00
|
|
|
find ./ -maxdepth 1 -name "*.py" -exec sed -i.bak '1i\
|
2014-05-21 21:36:24 +00:00
|
|
|
#!/usr/bin/env/python
|
2014-05-21 21:17:45 +00:00
|
|
|
' {} \;
|
|
|
|
|
2014-05-21 21:26:28 +00:00
|
|
|
# removes temporary files
|
|
|
|
find . -name "*.bak" -exec rm -rf {} \;
|
|
|
|
|
|
|
|
# makes Python scripts executable
|
|
|
|
chmod ug+x *.py
|