dracut-lib.sh: getarg() returns the value of the last argument

a=0 a=1 a=2
$(getarg a) == "2"
master
Harald Hoyer 2010-07-12 18:52:44 +02:00
parent ed61aae141
commit adde3a7a27
1 changed files with 2 additions and 1 deletions

View File

@ -18,8 +18,9 @@ getarg() {
fi
for o in $CMDLINE; do
[ "$o" = "$1" ] && { [ "$RDDEBUG" = "yes" ] && set -x; return 0; }
[ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; [ "$RDDEBUG" = "yes" ] && set -x; return 0; }
[ "${o%%=*}" = "${1%=}" ] && val=${o#*=};
done
[ -n "$val" ] && { echo $val; [ "$RDDEBUG" = "yes" ] && set -x; return 0; }
[ "$RDDEBUG" = "yes" ] && set -x
return 1
}