#!/bin/sh RPTSTR1="bottles of beer" RPTSTR2="on the wall" RPTSTR3="bottle of beer" REFRAIN="Take one down, pass it around" I=0 printf "How many bottles? :" read I while [ $I -ge 1 ] do if [ $I -eq 1 ]; then echo $I $RPTSTR3 $RPTSTR2, $I $RPTSTR3! else echo $I $RPTSTR1 $RPTSTR2, $I $RPTSTR1! fi echo $REFRAIN, I=`expr $I - 1` if [ $I -eq 1 ]; then echo "$I $RPTSTR3 $RPTSTR2.\n" else echo "$I $RPTSTR1 $RPTSTR2.\n" fi done