1 #!/bin/sh 2 # 3 # setpython - create a local link from 'python' to a specified version 4 # 5 # This script is used to to redirect the 'python' in a shebang line to 6 # a specified version when running regression tests. 7 8 if [ "$1" = python ] || [ "$1" = python2 ] || [ "$1" = python3 ] 9 then 10 p=$(command -v "$1") 11 case $p in 12 */bin/*) 13 # shellcheck disable=SC2086 14 ln -sf "$p" ./python; echo "python -> $p" 15 ;; 16 *) 17 #saved=`readlink ./python 2>/dev/null` 18 rm -f ./python 19 ;; 20 esac 21 else 22 echo "setpython: unrecognized python version" >&2 23 exit 1 24 fi