Loops in Bash shell or variable math...
I am trying to map the coordinates of a grid.
Code:
R=7 # number of rows (lines) |
Quote:
X=$(($X+$XDIS)) 1 The assignment should not start with the $ 2 Arithmetic is done within $(( )) Quote:
I'm only learning myself, so if I've led you astray, my apologies. It's a good idea to try snippets of code in a terminal. |
Thanks! That did it.
Thanks! Ed |
Also, for the sake of completeness, you don't need the $ inside the $(()) like below:
Code:
X=$((a+b) |
Or maybe even:
Code:
for ((i=1; i <= $R; i++)) |
All times are GMT -5. The time now is 10:03 AM. |