From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from plan9.research.att.com ([135.205.33.187]) by hawkwind.utcs.utoronto.ca with SMTP id <24649>; Thu, 1 May 1997 02:46:22 -0400 From: rsc@research.att.com Date: Wed, 30 Apr 1997 21:29:52 -0400 To: culliton@clark.net, rc@hawkwind.utcs.toronto.edu Subject: re: 99 bottles in an rc shell script. Message-Id: <97May1.024622edt.24649@hawkwind.utcs.utoronto.ca> This introduces a little more code in return for losing the count array. #!/bin/rc # rc shell version of 99 bottles of beer # by Tom Culliton (culliton@clark.net) # revised by Russ Cox (rsc@research.att.com) bottles = bottles; one = one digits = (9 8 7 6 5 4 3 2 1 0) for(i in $digits) for(j in $digits) { n = $i$j if(~ $i 0) n = $j if(! ~ $n 0) { if(~ $n 1) { bottles = bottle; one = it } if(! ~ $n 99) { echo $n $bottles 'of beer on the wall.' echo } echo $n $bottles 'of beer on the wall,' echo $n $bottles 'of beer,' echo 'take' $one 'down and pass it around,' } } echo 'no more bottles of beer on the wall!'