I have four variables like:
a1="11"
a2="22"
b1="111"
b2="222"
and now I want to create a loop to check if it is null or not:
for (( i=1; i<=2; i++)); do
eval "a=a$i"
eval "b=b$i"
if [ -z $a ] || [ -z $b ]; then
echo "variable-$a: condition is true"
fi
done
I want to count variable a and b then print the content of that. But in this way doesn't work and it checks:
a1
a2
b1
b2
But I need to check:
11
22
111
222
0), there are empty variables (""), there are unset variables. But what isnullsupposed to be?"11 22 111 222"instead?