Skip to content

Commit 8e9d81a

Browse files
committed
Use getopts instead of getopt
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>
1 parent a14eb74 commit 8e9d81a

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

scripts/bootstrap.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,22 +182,18 @@ DOCKER=true
182182
SAMPLES=true
183183
BINARIES=true
184184

185-
# Use 'getopt' to parse the command line arguments
186-
options=$(getopt -o b,d,h,s --long help -- "$@")
187-
188-
# Extract all flags from command line
189-
# Leave arguments
190-
eval set -- "$options"
191-
while [[ $# > 0 ]]; do
192-
case "$1" in
193-
-h|--help) printHelp ; exit ;;
194-
-b) BINARIES=false ;;
195-
-d) DOCKER=false ;;
196-
-s) SAMPLES=false ;;
197-
--) shift ; break ;;
198-
esac
199-
shift
185+
while getopts "h?dsb" opt; do
186+
echo $opt
187+
case "$opt" in
188+
d) DOCKER=false ;;
189+
s) SAMPLES=false ;;
190+
b) BINARIES=false ;;
191+
h|\?) printHelp
192+
exit 0
193+
;;
194+
esac
200195
done
196+
shift $(($OPTIND - 1))
201197

202198
# All that is left is arguments (no flags)
203199
case $# in

0 commit comments

Comments
 (0)