projects
/
grml-debootstrap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Automatically reboot after 10 seconds of inactivity after succesfully finishing autom...
[grml-debootstrap.git]
/
tests
/
test_cmdlineopts.sh
diff --git
a/tests/test_cmdlineopts.sh
b/tests/test_cmdlineopts.sh
index
940b048
..
312fe76
100755
(executable)
--- a/
tests/test_cmdlineopts.sh
+++ b/
tests/test_cmdlineopts.sh
@@
-12,14
+12,21
@@
test_cmdlineopts() {
IFS=,
for CMD in $CMDLINE_OPTS ; do
PARAM=""
IFS=,
for CMD in $CMDLINE_OPTS ; do
PARAM=""
+ DELIM=" "
+ # check if CMD is optional
+ if [[ $CMD == *:: ]] ; then
+ DELIM="="
+ fi
+ # CMD expects addional parameter
if [[ $CMD == *: ]] ; then
PARAM=$RANDOM
fi
if [[ $CMD == *: ]] ; then
PARAM=$RANDOM
fi
- VALUES[$count]="${CMD%%:*}
$PARAM"
+ VALUES[$count]="${CMD%%:*}
$DELIM
$PARAM"
((count++))
done
IFS=$OLDIFS
((count++))
done
IFS=$OLDIFS
+ # build the commandline
while [ "$i" -lt "$count" ] ; do
CMDLINE+="--${VALUES[$i]} "
((i++))
while [ "$i" -lt "$count" ] ; do
CMDLINE+="--${VALUES[$i]} "
((i++))
@@
-29,10
+36,13
@@
test_cmdlineopts() {
i=0
i=0
+ # check the result against input
while [ "$i" -lt "$count" ] ; do
ENTRY="${VALUES[$i]}"
VARNAME=${ENTRY% *}
while [ "$i" -lt "$count" ] ; do
ENTRY="${VALUES[$i]}"
VARNAME=${ENTRY% *}
+ VARNAME=${VARNAME%=*}
RESULT=${ENTRY/* /}
RESULT=${ENTRY/* /}
+ RESULT=${RESULT/*=/}
VARNAME='$_opt_'${VARNAME/-/_}
VALUE="$(eval echo $VARNAME)"
if [ -z "$RESULT" ] ; then
VARNAME='$_opt_'${VARNAME/-/_}
VALUE="$(eval echo $VARNAME)"
if [ -z "$RESULT" ] ; then