5 if [ $COUNT -ne 1 -o ! -d $1 ]; then
6 echo random_iter needs a directory name where the files to be randomly
7 echo chosen from are located.
11 NUMBER_OF_FILES=$(ls -1 $1/* | wc | awk '{ print $1; }')
13 if [ $NUMBER_OF_FILES -lt 1 ]; then
14 echo There are no files in $1.
18 RANDOM_CHOICE=$(expr $RANDOM % $NUMBER_OF_FILES + 1)
21 if [ $CURRENT_PLACE = $RANDOM_CHOICE ]; then
25 CURRENT_PLACE=$(expr $CURRENT_PLACE + 1)