[PATCH 2/4] easy-build.sh: use getopts instead of rolling our own option parsing.
---
easy-build.sh | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/easy-build.sh b/easy-build.sh
index c586c1e..d85d810 100755
--- a/easy-build.sh
+++ b/easy-build.sh
@@ -25,19 +25,23 @@ if [ $# -eq 0 ]; then
fi
desktop=
-if [ "$1" = "-d" ]; then
- case $2 in
- # Note: "gnome" is the special gnome task, not the generic task
- gnome|kde|lxde|xfce|light|all)
- desktop=$2
- shift 2
- ;;
- *)
- show_usage
- exit 1
- ;;
+while getopts d:h OPT ; do
+ case $OPT in
+ d)
+ case $OPTARG in
+ # Note: "gnome" is the special gnome task, not the generic task
+ gnome|kde|lxde|xfce|light|all)
+ desktop=$2
+ ;;
+ *)
+ show_usage
+ exit 1
+ ;;
+ esac ;;
+ h) show_usage; exit 1;;
esac
-fi
+done
+shift $(expr $OPTIND - 1)
export DISKTYPE="$1"
shift
--
1.6.3.3
Reply to: