We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c031649 commit 8ca2852Copy full SHA for 8ca2852
1 file changed
useful_scripts/prepend_python_shebang.sh
@@ -1,20 +1,20 @@
1
# Sebastian Raschka 05/21/2014
2
# Shell script that prepends a Python shebang
3
-# e.g., `!#/usr/bin/python` to all
+# '#!/usr/bin/env python' to all
4
# Python script files in the current directory
5
# so that script files can be executed via
6
# >> myscript.py
7
# instead of
8
# >> python myscript.py
9
10
-# prepends e.g., !#/usr/bin/python to all .py files
+# prepends '#!/usr/bin/env python' to all .py files
11
12
find ./ -maxdepth 1 -name "*.py" -exec sed -i.bak '1i\
13
-#!'"$(which python)"'
+#!/usr/bin/env python
14
' {} \;
15
16
# removes temporary files
17
find . -name "*.bak" -exec rm -rf {} \;
18
19
# makes Python scripts executable
20
-chmod ug+x *.py
+chmod ug+x *.py
0 commit comments