value to great for base error from bash associative array -


i have file called a.txt looks follow

7a1123123asd 14 8aasdasdasd 15 

now wrote bash code read file , build associative array values in it

#!/bin/bash declare -a counter while read deal count;     counter["$deal"]=$count done < oasload.job  in "${!array[@]}"     echo "key : $i"     echo "value : ${array[$i]}" done 

unfortunately when run following error

test.sh: line 6: 7a1123123asd: value great base (error token "7a1123123asd") 

any appreciated.

looks bash treats keys starting digits numeric. so, trying convert 7a balks because not valid base-10 digit. if can e.g. prefix keys x throughout, should fix it.

#!/bin/bash declare -a counter while read deal count;     counter["x$deal"]=$count done < oasload.job  in "${!array[@]}"     echo "key : $i"     echo "value : ${array[$i]}" done 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -