I created dynamic variables.
for (( c=1; c<=2; c++ ))
do
eval "prev$c=$number";
done
prev1, prev2
for (( c=1; c<=2; c++ ))
do
eval "current$c=$number";
done
current1, current2
if I have the variables
$prev1 is 1
$prev2 is 2
$current1 is 1
$current2 is 3
How do I compare inside a loop with if? Below is wrong, could someone correct the syntax? Thanks in advance.
for (( c=1; c<=2; c++ ))
do
if ((prev$i != current$i)); then
echo "prev$i is $prev[i] and current$i is $current[i], they are different"
fi
done
prevandcurrentare), then we might be able to help you with an even better solution.