I have to make a graph using bash and i have a weird thing going on. If i set the x and y indexes to 0 it will graph the first point, however, if i try to increment them or change them to a different number it doesn't graph anything. The way i have it set up is a while loop that goes through the rows or y values and then a while loop inside of that goes through the x values. It is a 40 by 80 grid so those numbers are set. Here is the function that graphs. If anyone sees any errors as to why it would graph the first point ok, but then not any others, I would appreciate it. I know i am not incrementing the indexes anywhere because if i try that it doesn't graph anything. So i thought it was not graphing all the points because i wasnt incrementing the indexes right, but even if i set the indexes to 1 instead of 0 it won't graph the second point. Anyone see what i'm doing wrong?
function graph
{
rows=40
cols=1
yIndexA=0 #go through y array
xIndexA=0 #go through x array
#gMinX=$(echo "scale=5 ; $minX - $1" | bc)
# gMaxY=$(echo "scale=5 ; $maxY + $2" | bc)
############################################################################
#loop through y values
while [ "$rows" -gt 0 ]
do
#gMaxY=$(echo "scale=5 ; ($gMaxY - $2)" | bc)
# blankSpacesDown=$(echo "scale=5 ; (${yValues[yIndex]} - $gMaxY - 1)" | bc)
#printSpacesDown $blankSpacesDown
#echo -n ${yValues[yIndex]}
#echo -n $gMaxY
#(( yIndex++ ))
echo
# reset things for innner loop
cols=1
xIndexA=0
##########################################################################
#loop through x values
while [ "$cols" -lt 81 ]
do
#gMinX=$(echo "scale=5 ; ($gMinX + $1)" | bc)
#blankSpaces=$(echo "scale=5 ; (${xValues[xIndex]} - $gMinX - $1)" | bc)
#printBlankSpaces $blankSpaces
#printBlankSpaces 4
#echo -n ${convertedYValues[yIndex]} " "
#echo -n ${convertedXValues[xIndex]} " "
#varX=${convertedXValues[xIndex]}
#varY=${convertedYValues[yIndex]}
#echo -n $rows " "
#echo -n $cols " "
if [ "$cols" == "${convertedXValues[xIndexA]}" ]
then
if [ "$rows" == "${convertedYValues[yIndexA]}" ]
then
echo -n "X"
fi
else
echo -n " "
fi
#echo -n ${xValues[xIndex]} " "
#echo -n $gMinX
#(( xIndex++ ))
#(( yIndex++ ))
(( cols++ ))
done # loop through x
#(( yIndex++ ))
(( rows-- ))
done # loop through y
echo
} # end graph function