rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: byron@netapp.com (Byron Rakitzis)
To: culliton@clark.net, rc@hawkwind.utcs.toronto.edu
Cc: john@LoVerso.Southborough.MA.US, rsalz@osf.org
Subject: Re: Speaking of counting...
Date: Sat, 3 May 1997 03:57:30 -0400	[thread overview]
Message-ID: <9705030757.AA15487@netapp.com> (raw)

Here's my version of seq:

#!/bin/rc
switch ($#*) {
case 1
        lo=1; hi=$1; incr=1
case 2
        lo=$1; hi=$2; incr=1
case 3
        lo=$1; hi=$2; incr=$3;
case *
        echo 'usage: seq [ lo ] hi [ incr ]' >[1=2]; exit 1
}

awk </dev/null 'END {
        if ('$incr' > 0) {
                for (i = '$lo'; i <= '$hi'; i += '$incr')
                        print i
        } else {
                for (i = '$lo'; i >= '$hi'; i += '$incr')
                        print i
        }
}'

It's possible that I got this from Paul Haahr (or someone else for
that matter --- I know my input-less awk scripts do all their work
in the BEGIN clause), and I don't have my plan9 manuals with me in
Europe so I have no idea if it matches up with plan9 seq.



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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-03  7:57 Byron Rakitzis [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-05-03 12:43 rsc
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=9705030757.AA15487@netapp.com \
    --to=byron@netapp.com \
    --cc=culliton@clark.net \
    --cc=john@LoVerso.Southborough.MA.US \
    --cc=rc@hawkwind.utcs.toronto.edu \
    --cc=rsalz@osf.org \
    --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).