I have a question for the people who know what they're talking about.
I'm writing a script. In it, I have a variable named ALLOWIP followed by a number. What I want to do is control the script based on if the variable has something in it or not and run a command (iptables if you must know) for every variable that isn't empty. The only problem is that I don't know how to evaluate a variable in a loop like this. I've done some testing and have so far:
for counter in 1 2 3
do
echo "$ALLOWIP$counter"
done
I'm planning on restructuring the loop as a while once it's done, but the concept is the same. I need to be able to concatenate a string with the contents of a variable, then use the result as the variable name and obtain the contents of that. Anybody know how to do such a thing?