rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: culliton@srg.af.mil (Tom Culliton x2278)
To: rc@archone.tamu.edu
Subject: Useful rc idiom
Date: Wed, 26 Feb 1992 13:47:29 -0600	[thread overview]
Message-ID: <9202261447.aa26127@ceres.srg.af.mil> (raw)

Please excuse me if I'm being redundant, I don't remember where I first
saw this or discovered it, but it seems like something that should
written in large letters.  When writing functions in rc a useful idiom
for local variables (what C calls auto) is something like this...

  fn func_name { xyz=() abc=$1 here=`{pwd} {
    # Body of the the function which can be called recursively with each
    # level getting it's own copy of the variables files, dirs and here.
    # The arguments of course are still in $1 $2 ....
  }}

This rc stuff sure is nice, isn't it. ;-)

Tom

BTW - if you don't do this and reuse variables inside a recursive
function it can be very hard to track down whats going on. ;-)


                 reply	other threads:[~1992-02-27  1:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=9202261447.aa26127@ceres.srg.af.mil \
    --to=culliton@srg.af.mil \
    --cc=rc@archone.tamu.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).