Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
99 bottles of beer
- X-seq: zsh-users 113
- From: Richard Coleman <coleman@xxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: 99 bottles of beer
- Date: Sun, 29 Oct 1995 03:22:08 -0500
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@xxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author