rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: rsc@research.att.com
To: culliton@clark.net, rc@hawkwind.utcs.toronto.edu
Subject: Re: Speaking of counting...
Date: Sat, 3 May 1997 08:43:33 -0400	[thread overview]
Message-ID: <97May3.143548edt.24660@hawkwind.utcs.utoronto.ca> (raw)

#!/bin/rc

first=0
last=0
incr=0
switch($#*) {
case 0
	echo 'Usage: $0 [first [incr]] last'
	exit 1
case 1
	last=$1
case 2
	first=$1
	last=$2
case 3
	first=$1
	incr=$2
	last=$3
}

awk -v 'first='$first -v 'last='$last -v 'incr='$incr 'BEGIN{
	if(incr == 0)
		incr = 1;
	if(first == 0)
		first = 1;
	for(i = first; i <= last; i += incr)
		print i;
}'

------ forwarded message follows ------

From hawkwind.utcs.toronto.edu!rc-owner Fri May  2 19:49:49 EDT 1997
Received: from corona.research.att.com by plan9; Fri May  2 19:49:49 EDT 1997
Received: from research.att.com (research.research.att.com [135.205.32.20]) by corona.research.att.com (8.7.5/8.7) with SMTP id TAA29692 for <rsc@corona.research.att.com>; Fri, 2 May 1997 19:50:01 -0400 (EDT)
Received: from hawkwind.utcs.utoronto.ca ([128.100.102.51]) by research; Fri May  2 19:48:54 EDT 1997
Received: from mail.clark.net ([168.143.0.10]) by hawkwind.utcs.utoronto.ca with SMTP id <24662>; Fri, 2 May 1997 19:45:47 -0400
Received: from clark.net (culliton@explorer.clark.net [168.143.0.7]) by mail.clark.net (8.8.5/8.6.5) with ESMTP id SAA17772; Fri, 2 May 1997 18:08:51 -0400 (EDT)
From: Tom Culliton <clark.net!culliton>
Received: (from culliton@localhost) by clark.net (8.8.5/8.7.1) id SAA16770; Fri, 2 May 1997 18:09:14 -0400 (EDT)
Date: 	Fri, 2 May 1997 18:09:14 -0400
Message-Id: <199705022209.SAA16770@clark.net>
To: hawkwind.utcs.toronto.edu!rc
Cc: LoVerso.Southborough.MA.US!john, osf.org!rsalz
Subject: Re: Speaking of counting...

So far jot and seq have been mentioned, (every machine I have available
says "jot not found" though... and ditto seq) but no specifics,

I have been accused of wanting to reinventing the wheel, (exactly what
I was trying to avoid)

Scott has shared some perl code, (Euw! The evil anit-rc!) ;-) (Thank
you.)

I swear I've seen this in rc/awk before...


             reply	other threads:[~1997-05-03 18:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-03 12:43 rsc [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-05-03  7:57 Byron Rakitzis
1997-05-02 22:09 Tom Culliton
1997-05-02  3:30 Rich Salz
1997-05-02 14:51 ` John Robert LoVerso
1997-05-01 21:40 Tom Culliton
1997-05-02  1:26 ` Scott Schwartz
1997-05-02  2:44 ` Charles M. Hannum
1997-05-02  5:52   ` Scott Schwartz

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=97May3.143548edt.24660@hawkwind.utcs.utoronto.ca \
    --to=rsc@research.att.com \
    --cc=culliton@clark.net \
    --cc=rc@hawkwind.utcs.toronto.edu \
    --subject='Re: Speaking of counting...' \
    /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

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