rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Alan Watson <alan@oldp.astro.wisc.edu>
To: rc@hawkwind.utcs.toronto.edu
Subject: RCRC
Date: Sat, 4 Sep 1993 18:10:49 -0400	[thread overview]
Message-ID: <9309042210.AA13356@oldp.astro.wisc.edu> (raw)

Although we have all worked out our own favorite work-arounds for the
rsh problem, I think I've come up with an rc specific solution which is
quite elegant:

	During start-up, rc examines the environment variable RCRC.  If
	the variable is set, rc attempts to source the file to which it
	refers; otherwise it sources .rcrc.  Before sourcing the file,
	rc sets RCRC to be the null string.  If the attempt to source
	the file fails, rc does not report an error.

So what happens in some common situations?

	login: RCRC is unset, so rc sets it to "" and sources .rcrc.

	rsh: ditto.

	exec of rc from beneath a login/rsh shell: RCRC is set to "",
	so the open() fails and nothing gets sourced.

All this seems to cost us in performance terms is a getenv() and open()
after each exec, and I very much doubt anyone will notice that.  We
gain a useful improvement in rc's interaction with the rest of UNIX,
and open up an interesting means to customize environments (by setting
RCRC in .rcrc).

Some things will break (like running rc in a clean environment from
env), but I can't think of anything too important.  

If you don't like the silence on error, then have rc set RCRC to
/dev/null before sourcing the file it points to.

Any comments?


             reply	other threads:[~1993-09-04 22:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-04 22:10 Alan Watson [this message]
1993-09-04 22:20 ` RCRC Chris Siebenmann
1993-09-05 12:00 ` RCRC John Mackin
1993-09-04 23:05 RCRC Alan Watson

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=9309042210.AA13356@oldp.astro.wisc.edu \
    --to=alan@oldp.astro.wisc.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).