github.com/influxdata/influxdb/v2@v2.7.6/env (about) 1 #!/bin/bash 2 3 set -e 4 5 # https://stackoverflow.com/a/246128 6 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 8 verbose_flag="" 9 while getopts vx arg; do 10 case "$arg" in 11 v) verbose_flag="--verbose";; 12 x) set -x;; 13 esac 14 done 15 shift $((OPTIND-1)) 16 17 export PKG_CONFIG="${DIR}/scripts/pkg-config.sh" 18 19 # If this script is being executed, it will be executed under bash 20 # so the bash source variable should be present. If the variable 21 # matches the current script, then we are being executed and the 22 # default argument should be to print the environment. 23 if [ $# -eq 0 ] && [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then 24 set -- env 25 fi 26 27 if [ $# -gt 0 ]; then exec "$@"; fi