Skip to content

Commit

Permalink
Use getopts instead of getopt
Browse files Browse the repository at this point in the history
The getopt that is provided in OS X is incompatible with version on
Linux.  Use builtin getopts instead. Fix for FAB-13009

Change-Id: I336d935665efb8270caa430705a6dff967e5a365
Signed-off-by: Tim Johnson <tijohnson@linuxfoundation.org>
  • Loading branch information
tijohnson committed Nov 28, 2018
1 parent a14eb74 commit 8e9d81a
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions scripts/bootstrap.sh
Expand Up @@ -182,22 +182,18 @@ DOCKER=true
SAMPLES=true
BINARIES=true

# Use 'getopt' to parse the command line arguments
options=$(getopt -o b,d,h,s --long help -- "$@")

# Extract all flags from command line
# Leave arguments
eval set -- "$options"
while [[ $# > 0 ]]; do
case "$1" in
-h|--help) printHelp ; exit ;;
-b) BINARIES=false ;;
-d) DOCKER=false ;;
-s) SAMPLES=false ;;
--) shift ; break ;;
esac
shift
while getopts "h?dsb" opt; do
echo $opt
case "$opt" in
d) DOCKER=false ;;
s) SAMPLES=false ;;
b) BINARIES=false ;;
h|\?) printHelp
exit 0
;;
esac
done
shift $(($OPTIND - 1))

# All that is left is arguments (no flags)
case $# in
Expand Down

0 comments on commit 8e9d81a

Please sign in to comment.