hi Gurus, please why is this happening:
when i run this:
#!/bin/bash
declare -a name
declare -a ph
declare -a eid
r=0;
c=1;
i=1;
n=;
echo " name phone email_id"
while :
do
#if [ $i>$n ]; then
#break;
#else
echo -n "field $i:"; read name[$r$c] ph[$r$c] eid[$r$c];
let "i++";
let "c++";
#fi
done
#echo "the values of fields are :"
#for((i=1;i<=n;i++))
#do
# echo "field$i:${fld[$r$i]} ${typ[$r$i]} ${con[$r$i]}"
#done
when i keep on entering the values, the while loop runs uptil c=7 for c=8 it gives error like:
prayush@prayush-desktop ~/Desktop $ grun.bash ./ex2
name phone email_id
field 1:abc 4327543 jhasdf@fdsj
field 2:sdf 23553 asf@sgfdfg
field 3:adsf 578543 asdfjdsaf
field 4:ahdfjhjk 4795636 gfhdhsdh
field 5:hretiuewndf 9805687954 fdsfjkfkj
field 6:asdfadsf
field 7:
field 8:
./ex2: line 15: 08: value too great for base (error token is "08")
when in Ist code ,if i make r=1, then it becomes an infinite loop. secondly when i uncomment if-else & for code in the script it skips the code with in 'else' and put null in the array variables .
still the problem of "value too great for base (error token is "08")" remains the same for r=0 & n>=8,for r=1 & n>=8 the 'while loop' breaks as per the condition.
heres the output:
prayush@prayush-desktop ~/Desktop $ ./ex2
name phone email_id
the values of fields are :
field1:
field2:
field3:
field4:
field5:
field6:
field7:
./ex2: line 24: 08: value too great for base (error token is "08")
what i actually wanted to do was, to read the values of variable until ctrl+d or ctrl+c or may be with any combination with 'ctrl' or 'Alt' if u can suggest. And when this shortkey is pressed i want to perform some custom actions.