I have a bunch of variables that I want to check, and if they contain a value of "No", I want to clear them.
var1=(check for some value, sometimes it returns "none")
var2=(check for some value, sometimes it returns "none")
var3=(check for some value, sometimes it returns "none")
someBizzareName=(check for some value, sometimes it returns "none")
if [[ "${var1}" == "None" ]] ; then
var1=""
fi
if [[ "${var2}" == "None" ]] ; then
var2=""
fi
And all this works fine and dandy, only since I have a lot of varN, I will have a ton if [[ "${varN}" == "None" ]] and . I need to know their names; so I was wondering, since it in BASH is very similar to searching and matching everything, if there is a wild card for variables inside a for loop that will match all vars, something like ${*}(I tried this, it doesn’t work)? I did all kinds of searches, but always found something about matching the contents of a variable, not about var itself.?
yphil source
share