zsh-users
 help / color / mirror / code / Atom feed
* 99 bottles of beer
@ 1995-10-29  8:22 Richard Coleman
  0 siblings, 0 replies; only message in thread
From: Richard Coleman @ 1995-10-29  8:22 UTC (permalink / raw)
  To: zsh-users

On the web page

http://www.ionet.net/~timtroyr/funhouse/beer.html

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
zsh.

Any suggestions for improvement?

#!/usr/local/bin/zsh
#
# zsh script version of 99 Bottles of Beer
# by Richard Coleman <coleman@math.gatech.edu>

printbottles() {
  local bottles

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

integer i=100

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



Richard Coleman
coleman@math.gatech.edu


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-10-29  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-10-29  8:22 99 bottles of beer Richard Coleman

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).