I don't think I understand how thr variable fits in here. I have read a bunch of tutorials, but I just don't understand. For me it seems to get in the way, although obviously I did it wrong here. Can someone explain?
[root@~]# bash array.sh
2 4 6
[root@~]# cat array.sh
#!/bin/bash
b=(1 2 3)
a=0
for i in ${b[@]}
do
narray[${a}]=$((${b[$a]}*2))
((a++))
done
echo ${narray[@]}
Test environment : centos 5.5 64bit
GNU bash, version 3.2.25
Perfect. I'm sure the other scripts accomplished the same thing, but this works and I understand it, and it demonstrates how to use the variable properly. Thanks so much!