rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: malte@techfak.uni-bielefeld.de
To: rc@archone.tamu.edu
Subject: an improvement(?) suggestion and a question
Date: Thu, 19 Mar 1992 06:54:55 -0600	[thread overview]
Message-ID: <9203191254.AA02417@dahlie.techfak.uni-bielefeld.de> (raw)

Hello *,

in rc's man page it says that $0 is set to name of the function during its
execution, so a naive thought came to my mind:

	fn sighup sigint {
		echo $progname was killed by $0 | mail somebody
		exit 2
	}

But this does not work since $0 when catching a signal is the name of
of the function rc was currently working on.

To change this, I have two suggestions:
	1) Change the signal handler to place the signals name in $0
	   and allow $* to be referenced with negative indices, with
	   $*(-1) evaluating to the name of the function the present
	   function was called from, $*(-2) ...

This is a more general solution, or

	2) Introduce a new special variable $signal which evaluates to
	   the name of the most current signal, so that the above example
	   will read
		...
		echo $progname was killed by $signal | mail somebody
		...

How about that?

Now the question: Does anybody know of a more elegant way to temporarily
disable the '-e' feature (exit on failure)? The only way I can think of is

	command || true

Malte.


             reply	other threads:[~1992-03-19 12:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-03-19 12:54 malte [this message]
1992-03-19 13:25 ` Matthew Farwell

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=9203191254.AA02417@dahlie.techfak.uni-bielefeld.de \
    --to=malte@techfak.uni-bielefeld.de \
    --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).