rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: "Mark K. Gardner" <mkgardne@cs.uiuc.edu>
To: rc@hawkwind.utcs.toronto.edu
Subject: re: 99 bottles in an rc shell script.
Date: Thu, 1 May 1997 17:13:39 -0400	[thread overview]
Message-ID: <199705012113.QAA09988@pertsserver.cs.uiuc.edu> (raw)

I had to join in the fun (even though I don't drink beer).

This one not only drinks beer, it also eats CPU. 
(You get a test mode free of charge by typing "beer <num>".
It may or may not use builtins exclusively...
depending on your philosophy.)

-- 
Mark K. Gardner (mkgardne@cs.uiuc.edu)
University of Illinois at Urbana-Champaign
Real-Time Systems Laboratory
-- 

=== File: beer ===
#!/bin/rc
# rc shell version of 99 bottles of beer
# by Tom Culliton (culliton@clark.net)
# revised by Mark Gardner (mkgardne@cs.uiuc.edu)

# Supply the path to this script...
again = `{pwd}^/beer

if (~ $#* 0) {
	count = 99
} else {
	count = $1
}

bottles = bottles; one = one
if (! ~ $count 0) {
	if (~ $count 1) {bottles = bottle; one = it}
	if (! ~ $count 99) {
		echo $count $bottles 'of beer on the wall.'
		echo
	}
	echo $count $bottles 'of beer on the wall,'
	echo $count $bottles 'of beer,'
	echo 'take' $one 'down and pass it around,'
	$again `{expr $count - 1}
} else {
	echo 'no more bottles of beer on the wall!'
}


             reply	other threads:[~1997-05-02  1:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-01 21:13 Mark K. Gardner [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-05-01 19:28 Byron Rakitzis
1997-05-01 17:14 Tom Culliton
1997-05-01  5:02 Tom Culliton
1997-05-01  4:03 Tom Culliton
1997-05-01  1:29 rsc
1997-04-30 22:26 Tom Culliton
1997-05-01  1:57 ` David Luyer
1997-05-01 16:33 ` Paul Haahr

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=199705012113.QAA09988@pertsserver.cs.uiuc.edu \
    --to=mkgardne@cs.uiuc.edu \
    --cc=rc@hawkwind.utcs.toronto.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.
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).