Select the Python interpreter using -2, -3 and yolo

This commit is contained in:
Guillaume Valadon 2020-03-14 10:33:30 +01:00
parent 6768e464d0
commit fea00d59a3
1 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,17 @@
#! /bin/sh
DIR=$(dirname $0)
PYTHON=${PYTHON:-python3}
PYTHONPATH=$DIR exec $PYTHON -m scapy $@
DIR=$(dirname "$0")
if [ -z "$PYTHON" ]
then
ARGS=$(getopt 23 "$*")
for arg in $ARGS
do
case $arg
in
-2) PYTHON=python2; shift;;
-3) PYTHON=python3; shift;;
--) shift; break;;
esac
done
PYTHON=${PYTHON:-python3}
fi
PYTHONPATH=$DIR exec "$PYTHON" -m scapy "$@"