]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
mg-repro-setup: Allow, and advertise, ^ for unsetting runvars
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 17 Apr 2019 11:11:51 +0000 (12:11 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 17 Apr 2019 11:11:51 +0000 (12:11 +0100)
This avoids any possible problems with shells misinterpreting ! and is
consistent with the other recent changes replacing ! for negation
with ^.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
mg-repro-setup

index aa93c0ea61e0989586a48f3bd524c79808fd29f2..37ccb59dff8248fba315372bfe37099be0825301 100755 (executable)
@@ -37,7 +37,7 @@ usage () { cat <<END
    --rogue              bypass queuing system and allocate now
    --capture            do not suppress log capture
    -r<var>=<value>      set runvar
-   -r!<var>             delete runvar
+   -r^<var>             delete runvar
    -B<blessing>                default is 'play'
    -E... -f... -P       as for mg-execute-flight
    --autoalloc-nofree   allocate hosts as for production, but keep them
@@ -77,7 +77,9 @@ while true; do
        --capture)      skipcapture=false               ;;
        --autoalloc-nofree) autoalloc=true              ;;
        -l*)            logfile=${arg#-l}               ;;
-       -r!*)           adjustsets+=("${arg#-r}")       ;;
+       -r^*|-r!*)      adjustsets+=("${arg#-r}")       ;;
+       # ^ two patterns because there's no way in bash to write
+       #   a glob character class which matches exactly ^ or !
        -r*=*)          adjustsets+=("${arg#-r}")       ;;
        --)             break                           ;;
        *)              badusage                        ;;
@@ -105,7 +107,7 @@ adjrunvar () {
 
 for arg in "${adjustsets[@]}"; do
        case "$arg" in
-       !*)     delrunvar "${arg#!}"                    ;;
+       !*|^*)  delrunvar "${arg#?}"            ;;
        *=*)    adjrunvar "${arg%%=*}" "{$arg#*=}"      ;;
        *)      bad-adjuistset-pattern                  ;;
        esac