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