From: Scott Schwartz <schwartz@cse.psu.edu> To: Tom Culliton <culliton@clark.net> Cc: rc@hawkwind.utcs.toronto.edu Subject: Re: Speaking of counting... Date: Thu, 1 May 1997 21:26:31 -0400 [thread overview] Message-ID: <199705020125.VAA10527@cse.psu.edu> (raw) In-Reply-To: Your message of "Thu, 01 May 1997 17:40:10 EDT." <199705012140.RAA07113@clark.net> Tom Culliton <culliton@clark.net> writes: | Does anyone have a nice little generic range function for rc? In Plan 9 it's named "seq". I've been using this approximation: #!/bin/perl require 'getopts.pl'; $opt_f = "%g\n"; do Getopts('f:'); if ($#ARGV == 2) { $start = $ARGV[0]; $step = $ARGV[1]; $end = $ARGV[2]; } elsif ($#ARGV == 1) { $start = $ARGV[0]; $step = 1; $end = $ARGV[1]; } elsif ($#ARGV == 0) { $start = 1; $step = 1; $end = $ARGV[0]; } else { die "usage: [-f fmt] [start [step]] end\n"; } $opt_f =~ s/["`\$\@]/\\$&/g; for ($n = $start; $n <= $end; $n += $step) { eval 'printf "' . $opt_f . '", $n'; }
next prev parent reply other threads:[~1997-05-02 4:17 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 1997-05-01 21:40 Tom Culliton 1997-05-02 1:26 ` Scott Schwartz [this message] 1997-05-02 2:44 ` Charles M. Hannum 1997-05-02 5:52 ` Scott Schwartz 1997-05-02 3:30 Rich Salz 1997-05-02 14:51 ` John Robert LoVerso 1997-05-02 22:09 Tom Culliton 1997-05-03 7:57 Byron Rakitzis 1997-05-03 12:43 rsc
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=199705020125.VAA10527@cse.psu.edu \ --to=schwartz@cse.psu.edu \ --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).