fixing bash if statement issues related to negation
This commit is contained in:
parent
8d5e3d007d
commit
64db728731
@ -10,12 +10,12 @@ fi
|
|||||||
# this will let us know if the vm exists or not
|
# this will let us know if the vm exists or not
|
||||||
exists="false"
|
exists="false"
|
||||||
state = "unknown"
|
state = "unknown"
|
||||||
if ! virsh domuuid "$vmname" | grep -qE '^[\t\s\n]*$'; then
|
if virsh domuuid "$vmname" | grep -vqE '^[\t\s\n]*$'; then
|
||||||
exists="true"
|
exists="true"
|
||||||
|
|
||||||
state_code="$(virsh domstats $vmname | grep state.state | cut -d '=' -f 2)"
|
state_code="$(virsh domstats $vmname | grep state.state | cut -d '=' -f 2)"
|
||||||
|
|
||||||
if ! printf "$state_code" | grep -qE '^[0-8]$'; then
|
if printf "$state_code\n" | grep -vqE '^[0-8]$'; then
|
||||||
printf 'state_code was not detected. state_code %s must match ^[0-8]$\n' "$state_code"
|
printf 'state_code was not detected. state_code %s must match ^[0-8]$\n' "$state_code"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user