zsh-users
 help / color / mirror / code / Atom feed
From: Richard Coleman <coleman@math.gatech.edu>
To: zsh-users@math.gatech.edu
Subject: 99 bottles of beer
Date: Sun, 29 Oct 1995 03:22:08 -0500	[thread overview]
Message-ID: <199510290822.DAA02545@redwood.skiles.gatech.edu> (raw)

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


                 reply	other threads:[~1995-10-29  8:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199510290822.DAA02545@redwood.skiles.gatech.edu \
    --to=coleman@math.gatech.edu \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).