rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* A startup function for interactive rc's is unnecessary
@ 1991-08-27 19:07 Chris Siebenmann
  1991-08-31  9:58 ` John Mackin
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Siebenmann @ 1991-08-27 19:07 UTC (permalink / raw)
  To: rc

 After some thought, instead of hacking, I realized that all the
functionality of a function that's run on interactive startup can be
done with a prompt function. The trick is to figure out how to
recognize when you're in a new shell, and the easy way to do that is to
compare $pid against a saved version of it, so:
	fn prompt { if (~ $cpid $pid) {cpid=$pid; <initialize>} }
As an extra bonus, this gets run naturally even for login shells.

 This leaves the question of whether there's any use for a function
executed automatically at the start of non-interactive rc shells;
I can't think of any.

	- cks


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

end of thread, other threads:[~1991-08-31 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-08-27 19:07 A startup function for interactive rc's is unnecessary Chris Siebenmann
1991-08-31  9:58 ` John Mackin

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