Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f71bcde

Browse files
committed
autodetect python version
1 parent 80fb307 commit f71bcde

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

useful_scripts/prepend_python_shebang.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
# >> python myscript.py
99

1010
# prepends !#/usr/bin/python to all .py files
11+
12+
python_ver=$(which python)
1113
find ./ -maxdepth 1 -name "*.py" -exec sed -i.bak '1i\
12-
#!/usr/bin/env/python
14+
#!/usr/bin/env/python"$python_ver"
1315
' {} \;
1416

1517
# removes temporary files

0 commit comments

Comments
 (0)