[SLUG] arrays

Stephen O'Neill soneill84 at yahoo.co.uk
Mon Nov 28 11:08:11 GMT 2005


Martin Webb wrote:
> I'm using:
> array=( `cat "$filename"`)     #  Loads contents from data file 
Ok, this does work:

====================
filename="test2.txt"
declare -a arr
i=0

while read line
do
    arr[$i]=${line}
    let "i++"
done < "$filename"

echo ${arr[0]}
echo ${arr[1]}
====================

Steve O

	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com




More information about the Scarborough mailing list