From c744d0f3defaeec69a42708fb72f0dc1a63b8c5c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 17 Apr 2019 12:11:51 +0100 Subject: [PATCH] mg-repro-setup: Allow, and advertise, ^ for unsetting runvars 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 --- mg-repro-setup | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mg-repro-setup b/mg-repro-setup index aa93c0ea..37ccb59d 100755 --- a/mg-repro-setup +++ b/mg-repro-setup @@ -37,7 +37,7 @@ usage () { cat <= set runvar - -r! delete runvar + -r^ delete runvar -B 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 -- 2.39.5