Hi guys and gals.  I need a little scripting help.  I need an array, but
I need to represent the index with a variable.  Everything looks like
it's working through the for loop, but when printing the values, I get
empty strings.

quick sample script:

#!/bin/bash
# Begin tempscript

somelist="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"

declare -a arrayname
count=0
# Assign values
for i in $somelist; do
    arrayname[$count]=$i
    let count++
done

# Now print the values
tmpcount=$count
count=0
while [ $count -lt $tmpcount ]; do
    echo $arrayname[$count]
    let count++
done

# End tempscript

AFAICT, all looks correct, but the values are all empty.  I know I'm
overlooking something obvious, but I just can't see it.

-- DJ Lucas
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to