MAJOR problem .. bash scripts ... HELP !!!
Hello,
I am writing a bash script to do a compare between 8 files and fine the common lowest multipler.
I can not use diff because of the file format and how it changes.
So I started off with an array loop
#!/bin/bash
declare -a masnew
index=0
cat file1 | while read line
do
masnew[$index]="$line"
let "index = $index + 1"
echo ${masnew[6]} ### used for test
done
echo ${masnew[6]} ### used for test
Ok ... now inside the loop the echo statement prints the 6th element of the array repeatedly as it should. Out side the loop it print " ". That is right a null value. The array is completely empty out side the loop ?
I having tried this on slackware 9.1, 9.0 and 8.1 with all the same results. I have tried different shells. I have even compiled bash from source.
I have not get this to work, I this for a project I am doing so it is important.
Any suggestions would help !!!!
Michael.
|