This should be easy! I need to add the numbers in a string.
e.g
VALUE=138
I need the sum of 1+3+8.
I imagine something like"
i=0
for [ number of chars in string ]
do
TOTAL=`expr $TOTAL + $VALUE`
increment i
done
This example will give a TOTAL of 13.
I then need to identify the left-most value in this number, in this case 1.
Idea's on the best way to do this?
e.g
VALUE=138
I need the sum of 1+3+8.
I imagine something like"
i=0
for [ number of chars in string ]
do
TOTAL=`expr $TOTAL + $VALUE`
increment i
done
This example will give a TOTAL of 13.
I then need to identify the left-most value in this number, in this case 1.
Idea's on the best way to do this?