Skip to content

Commit

Permalink
Make sensor-dicoms use gnu-getopt if present (on OSX)
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikoptic committed Dec 8, 2023
1 parent c1ed1c0 commit 16b5098
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion utils/sensor-dicoms
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ show_usage() {
echo "Usage: $0 [--dry-run|-n] --move-to DIRNAME directory [directory2 ...]"
}

# On OSX we better use GNU one
if [ -e /usr/local/opt/gnu-getopt/bin/getopt ]; then
getopt=/usr/local/opt/gnu-getopt/bin/getopt
else
getopt=getopt
fi

# Parsing options
TEMP=$(getopt -o 'n' --long move-to:,dry-run -n "$(basename "$0")" -- "$@")
TEMP=$("$getopt" -o 'n' --long move-to:,dry-run -n "$(basename "$0")" -- "$@")
# shellcheck disable=SC2181
if [ $? != 0 ]; then echo "Terminating..." >&2; exit 1; fi

Expand Down

0 comments on commit 16b5098

Please sign in to comment.