mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-23 20:11:13 +00:00
shell script for prepending shebangs
This commit is contained in:
parent
f361524fea
commit
040b553a00
|
@ -38,6 +38,8 @@ Useful functions, tutorials, and other Python-related things
|
|||
- Happy Mother's Day [[IPython nb]](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/funstuff/happy_mothers_day.ipynb?create=1)
|
||||
|
||||
|
||||
**// useful snippets**
|
||||
**// useful scripts snippets**
|
||||
|
||||
- [Shell script](./useful_scripts/prepend_python_shebang.sh) for prepending Python-shebangs to all .py files in a current directory.
|
||||
|
||||
- convert 'tab-delimited' to 'comma-separated' CSV files [[IPython nb]](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/useful_scripts/fix_tab_csv.ipynb?create=1)
|
||||
|
|
14
useful_scripts/prepend_python_shebang.sh
Normal file
14
useful_scripts/prepend_python_shebang.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
# 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
|
||||
|
||||
find ./ -maxdepth 1 -name "*.py" -exec sed -i.bak '1i\
|
||||
!#/usr/bin/python
|
||||
' {} \;
|
||||
|
||||
find . -name "*.bak" -exec rm -rf {} \;
|
Loading…
Reference in New Issue
Block a user