I've something like this:
declare -r constant1=0
declare -r constant2=0
for xx in 1 2 3 4 5 6 7 8 9 10
do
constant1=$((constant1 + 1))
for yy in 8 7 3 9 3 9 2 8 4 4
do
constant2=$((constant2 + 1))
if [ $constant1 == $constant2 ]; then
something here bla bla
fi
done
done
But it's giving me an error, namely:
line 6: constant1: readonly variable
How do I go about fixing this?
Basically, I want the " do something here bla bla" to run whenever constant1 = constant2. that is, [xx,yy] = [1,8],[2,7], etc
help declare
and option-r
.help declare