Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language AWK

Date:04/20/05
Author:Whitey
URL:n/a
Comments:4
Info:n/a
Score: (3.43 in 35 votes)
#!/usr/bin/awk -f
#   awk version of 99 bottles of beer
#   by Whitey (whitey@netcom.com) - 06/05/95

BEGIN { 
   for(i = 99; i > 0; i--) {
      print s = bottle(i), "on the wall,", s ","
      print "take one down, pass it around,"
      print bottle(i - 1), "on the wall."
   }
}

function bottle(n) {
   return sprintf("%s bottle%s of beer", n ? n : "no more", n - 1 ? "s" : "")
}

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
correct textOsamuAoki11/03/072
bottled versionWilhelm Weske11/16/080
3Arnold Robbins01/25/080

Comments

>>  Vincent Schmid said on 07/19/05 09:51:54

Vincent Schmid A bit too short : Where is the last part of the song ?
Go to the store and buy some more...

>>  hardus said on 07/19/05 10:03:15

hardus Best one I'v seen :)

>>  ananomous said on 12/01/06 21:15:35

ananomous language sucks.








not really..............................just does'nt make sense

>>  donk0yote said on 12/28/06 15:36:00

donk0yote GREAT!!! just another fine example of the simplicity and power of AWK.

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: