Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

99 bottles of beer

On the web page


There are programs/scripts that will generate the
words to "99 bottles of beer on the wall" in many
different languages.  Since there was a version for
sh and 2 versions for csh, I decided we needed to
submit one for zsh.  This is what I came up with.
Unfortunately it doesn't use any cool features of

Any suggestions for improvement?

# zsh script version of 99 Bottles of Beer
# by Richard Coleman <coleman@xxxxxxxxxxxxxxx>

printbottles() {
  local bottles

  if (($1 == 0)) then
    bottles="no more bottles of beer"
  elif (($1 == 1)) then
    bottles="1 bottle of beer"
    bottles="$1 bottles of beer"
  print -n $bottles$2

integer i=100

while((i > 0))
  printbottles $i " on the wall, "
  printbottles $i ".\n"
  print -n "Take one down, pass it around, "
  printbottles $i " on the wall.\n"

Richard Coleman

Messages sorted by: Reverse Date, Date, Thread, Author