From f71bcde1b3a1ec6378fd70fa0903401439a6ea55 Mon Sep 17 00:00:00 2001 From: rasbt Date: Wed, 21 May 2014 17:44:05 -0400 Subject: [PATCH] autodetect python version --- useful_scripts/prepend_python_shebang.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/useful_scripts/prepend_python_shebang.sh b/useful_scripts/prepend_python_shebang.sh index 8555f39..e57cc49 100644 --- a/useful_scripts/prepend_python_shebang.sh +++ b/useful_scripts/prepend_python_shebang.sh @@ -8,8 +8,10 @@ # >> python myscript.py # prepends !#/usr/bin/python to all .py files + +python_ver=$(which python) find ./ -maxdepth 1 -name "*.py" -exec sed -i.bak '1i\ -#!/usr/bin/env/python +#!/usr/bin/env/python"$python_ver" ' {} \; # removes temporary files