aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-02-09 05:47:04 +0000
committerMike Frysinger <vapier@gentoo.org>2010-02-09 05:47:04 +0000
commit51be4d482b69c3b1a7f9179574336c094cf01318 (patch)
treeb1cbc5dce38b118e3e56d143984ca3f298fe5356
parentfilter .cvsignore files from dist too (diff)
downloadpax-utils-51be4d482b69c3b1a7f9179574336c094cf01318.tar.gz
pax-utils-51be4d482b69c3b1a7f9179574336c094cf01318.tar.bz2
pax-utils-51be4d482b69c3b1a7f9179574336c094cf01318.zip
switch from getopt program to getopts shell builtin
-rwxr-xr-xlddtree.sh20
-rwxr-xr-xsymtree.sh18
2 files changed, 15 insertions, 23 deletions
diff --git a/lddtree.sh b/lddtree.sh
index 3f25b99..d8e2676 100755
--- a/lddtree.sh
+++ b/lddtree.sh
@@ -102,20 +102,16 @@ if [[ $1 != "/../..source.lddtree" ]] ; then
SHOW_ALL=false
SET_X=false
-([[ $1 == "" ]] || [[ $1 == --help ]]) && usage 1
-opts="hax"
-getopt -Q -- "${opts}" "$@" || exit 1
-eval set -- $(getopt -- "${opts}" "$@")
-while [[ -n $1 ]] ; do
- case $1 in
- -a) SHOW_ALL=true;;
- -x) SET_X=true;;
- -h) usage;;
- --) shift; break;;
- -*) usage 1;;
+while getopts hax OPT ; do
+ case ${OPT} in
+ a) SHOW_ALL=true;;
+ x) SET_X=true;;
+ h) usage;;
+ ?) usage 1;;
esac
- shift
done
+shift $((OPTIND - 1))
+[[ -z $1 ]] && usage 1
${SET_X} && set -x
diff --git a/symtree.sh b/symtree.sh
index d34d082..d76a22d 100755
--- a/symtree.sh
+++ b/symtree.sh
@@ -68,19 +68,15 @@ show_elf() {
SET_X=false
-([[ $1 == "" ]] || [[ $1 == --help ]]) && usage 1
-opts="hx"
-getopt -Q -- "${opts}" "$@" || exit 1
-eval set -- $(getopt -- "${opts}" "$@")
-while [[ -n $1 ]] ; do
- case $1 in
- -x) SET_X=true;;
- -h) usage;;
- --) shift; break;;
- -*) usage 1;;
+while getopts hx OPT ; do
+ case ${OPT} in
+ x) SET_X=true;;
+ h) usage;;
+ *) usage 1;;
esac
- shift
done
+shift $((OPTIND - 1))
+[[ -z $1 ]] && usage 1
${SET_X} && set -x