Is this what you are looking for? It loads up an array from a file and prints the indices with the last index being the first index the next time through the master loop. There may be a simpler way.
Code:
#!/bin/sh
INFILE="readfile"
declare -a WORDARRAY
WORDARRAY=(`cat $INFILE`)
WORDCOUNT=`echo ${WORDARRAY[@]} | wc -w`
NUMCYCLES=$WORDCOUNT
COUNT=0
CURRENT=0
while [ $COUNT -lt $NUMCYCLES ]; do
INDEX=0
while [ $INDEX -lt $WORDCOUNT ]; do
INDEX=`expr $INDEX + 1`
printf "${WORDARRAY[CURRENT]} "
if [ $INDEX -lt $WORDCOUNT ]; then
CURRENT=`expr $CURRENT + 1`
fi
if [ $CURRENT -eq $WORDCOUNT ]; then
CURRENT=0
fi
done
printf "\n"
COUNT=`expr $COUNT + 1`
done
[Edited by crabboy on 04-15-2001 at 12:33 PM]