I am trying to print the $a and $BIT values.
But I'm receiving the value of $BIT but not $a.
Please find the code as follows,
echo "Content-type: text/html"
echo ""
echo "<html><head><META HTTP-EQUIV='refresh' CONTENT="1"></head>"
VAL[0] =1;
VAL[1] =0;
VAL[2] =1;
for CNT in $(seq 32)
do
BIT = ${VAL[$CNT]};
a = $(($CNT-1));
echo "<p>$a,$BIT</p>";
done
Please help me on this.
Thanks in advance.
=)? I ran your script and it ran fine, although thefor CNT...loop starts withCNTvalue of1, but you probably intend0. It does otherwise show the defined values of both$aand$BIT.for CNT in $( seq 0 31)and your problems will go away (as @lurker says, you will have the proper array entry and no need to compute $a, just use $CNT)