This is not a Tru64 specific question, but bash should be widely 
used under this OS!
I would like to count and compare the list of RMP between two nodes. 
The bash script below (a short test script), create the list, read 
it into an array and count the number of lines.
The strange thing appear at the end of the ?while? loop, the last 
?printf? command always display 0 for index value! 
But, inside the loop, index and RMP name are correctly displayed!  
My question: 
        Why array data and index are lost at the end of the loop?
Any help will be greatly appreciated.
------------------------------------------------------------------
#!/bin/bash
#----------> For test only
#
TMPFILE="RPM.lst"
declare -i RPMCNT=0     # Array index
declare -a RPMLIST      # Array for RPM list
#
rpm -qa > $TMPFILE
#
cat < $TMPFILE | while true
     do
        read LINE
        if [ "X$LINE" = "X" ]; then break; fi   # Empty line !
        let RPMCNT=RPMCNT+1                     # Update index
        RPMLIST[$RPMCNT]=$LINE                  # Update array
        printf "%4i %4i  %-s\n" $RPMCNT ${#RPMLIST[*]} \
                                ${RPMLIST[$RPMCNT]}
     done
#
printf "\nRPM count: %4i %4i\n" $RPMCNT ${#RPMLIST[*]}
if [ -f $TMPFILE ]; then rm -f $TMPFILE; fi
exit 0
------------------------------------------------------------------
Jean-Pierre Vorlet   Jean-Pierre.Vorlet_at_unifr.ch   +41 26 300 7218
 System Manager        University of Fribourg          Switzerland
Received on Thu Sep 12 2002 - 07:56:27 NZST