In a shell script, I have a list of variables that I've ordered as $a, $b, $c, etc. I'd like to print these variables without having to list all the variables. My current code is as follows:
a=1
b=2
c=3
d=4
e=5
f=6
g=7
for x in $a$b$c$d$e$f$g
do
echo "$x"
done
Can I shorten $a$b$c$d$e$f$g to something that refers to $a through $g?
echo
will run just once? Whyfor
then? Is it because some characters in variables (c=" "
ord=" /* "
) can make it run more than once? This only makes the code more awkward. Is this really what you want to do?