rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* an improvement(?) suggestion and a question
@ 1992-03-19 12:54 malte
  1992-03-19 13:25 ` Matthew Farwell
  0 siblings, 1 reply; 2+ messages in thread
From: malte @ 1992-03-19 12:54 UTC (permalink / raw)
  To: rc

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1992-03-19 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-03-19 12:54 an improvement(?) suggestion and a question malte
1992-03-19 13:25 ` Matthew Farwell

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).