diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2019-09-26 17:52:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-26 17:52:37 -0700 |
commit | 3aafd4a2ced87f0fd82ebe5279b73c84552502d5 (patch) | |
tree | 2e96b3cf82d4a1d2c74bb5a6b3227d5afb3716d1 /contrib/get-script-header.sh | |
parent | 9ba1854be7d798a899a2b46c2707d376938c5d18 (diff) | |
parent | 923abd7000a2ab6e3c0776c59d159bdc3a4d9a52 (diff) |
Merge branch 'master' into splitEqRew
Diffstat (limited to 'contrib/get-script-header.sh')
-rw-r--r-- | contrib/get-script-header.sh | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/get-script-header.sh b/contrib/get-script-header.sh index de4a93587..4e2a133b3 100644 --- a/contrib/get-script-header.sh +++ b/contrib/get-script-header.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash # -set -e +set -e -o pipefail cd "$(dirname "$0")/.." @@ -15,12 +15,24 @@ if ! [ -e src/parser/cvc/Cvc.g ]; then fi function webget { - if which wget &>/dev/null; then + if [ -x "$(command -v wget)" ]; then wget -c -O "$2" "$1" - elif which curl &>/dev/null; then + elif [ -x "$(command -v curl)" ]; then curl -L "$1" >"$2" else echo "Can't figure out how to download from web. Please install wget or curl." >&2 exit 1 fi } + +for cmd in python python2 python3; do + if [ -x "$(command -v $cmd)" ]; then + PYTHON="$cmd" + break + fi +done + +if [ -z "$PYTHON" ]; then + echo "Error: Couldn't find python, python2, or python3." >&2 + exit 1 +fi |