Commit 33661db3 authored by John A's avatar John A

Merge branch 'MacCompat'

Adding MacOS compatibility
parents 3f43b093 b0978874
......@@ -42,13 +42,14 @@ changed=()
seed="$RANDOM"
# ensure MacOS compatibility with GNU getopt
if [ "$(uname)" = 'Darwin' ]; then
GGETOPT="/usr/local/Cellar/gnu-getopt/*/bin/getopt" # should link to gnu-getopt
if [[ ! -x "$GGETOPT" ]]; then # file is not executable
printf '%s\n' 'Error: Running on MacOS requires gnu getopt.'
if [[ "$OSTYPE" == 'darwin'* ]]; then
GGETOPT=/usr/local/Cellar/gnu-getopt/*/bin/getopt # should find gnu-getopt
if [ ! -x $GGETOPT ]; then # file is not executable
printf '%s\n' 'Error: Running on MacOS requires an executable gnu getopt.'
exit 2
fi
getopt() { $GGETOPT "$@"; } # replace getopt with gnu getopt
shopt -s expand_aliases
alias getopt='$GGETOPT' # replace getopt with gnu getopt
fi
# ------ parse options ------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment