Hi All,
Im trying to separate digits from a number and assign the number to different variables.
eg: if number is 243
then
a1 = 2
a2 = 4
a3 = 3
Im able to get the separate numbers but not able to generate a variables on the go and assign the values to them. Can some one please help me on this issue. Below is my code
Code:-
#!/bin/bash
read n
for ((i=1;i<1000;))
do
###############
i=$(($i*10))
y=$(($n%10))
echo $y
################
x=$(($n-$y))
echo $x
n=$(($x/10))
echo $n
#############
for j in {1 …3}
do
v[j]=$y
echo $v1 $v2 $v3
done
done
#############################
Thanks in advance