[K12OSN] OT: Bash help
Peter Hartmann
ascensiontech at gmail.com
Mon Nov 19 17:59:16 UTC 2007
I'm trying to set up a large number of arrays with a for do loop.
It's not working, so to troubleshoot I'm simplifying it and only
seeing if can set up an array variable with a variable.
LIST=ffirst
#Declare array
declare -a ffirst
#Open file for reading to array
exec 10<ffirst # ffirst is also my filename
let count=0
while read LINE <&10; do
$LIST[$count]=$LINE
((count++))
done
exec 10>&-
I's choking like this:
./create-csv3: line 62: ffirst[0]=Carmine: command not found
./create-csv3: line 62: ffirst[1]=: command not found
./create-csv3: line 62: ffirst[2]=: command not found
./create-csv3: line 62: ffirst[3]=Leonardo: command not found
./create-csv3: line 62: ffirst[4]=William: command not found
./create-csv3: line 62: ffirst[5]=: command not found
Is there a way to do what I want?
Thanks,
Peter
More information about the K12OSN
mailing list