"Fossies" - the Fresh Open Source Software Archive

Member "deheader-1.10/test/setpython" (30 Jan 2023, 551 Bytes) of package /linux/privat/deheader-1.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "setpython": 1.6_vs_1.7.

    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