From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ditsydh.syd.dit.csiro.au ([130.155.128.18]) by archone.tamu.edu with SMTP id <22531>; Fri, 23 Aug 1991 09:19:50 -0500 Received: by ditsydh.syd.dit.csiro.au id AA28885 (5.64+/IDA/DIT-0.9 for rc@archone.tamu.edu); Sat, 24 Aug 91 00:19:27 +1000 From: John Mackin Date: Fri, 23 Aug 1991 08:40:03 -0500 To: The rc Mailing List Subject: Re: early reaction(s) to rc In-Reply-To: <91Aug22.203613cdt.22531@archone.tamu.edu> Message-Id: <9108232340.26762.rc.bafoj@syd.dit.csiro.au> X-Face: 39seV7n\`#asqOFdx#oj/Uz*lseO_1n9n7rQS;~ve\e`&Z},nU1+>0X^>mg&M.^X$[ez>{F k5[Ah<7xBWF-@-ru?& @4K4-b`ydd^`(n%Z{ Hi, Chris, welcome to the rc list. I am puzzled by some of your comments, and would like to ask you to expand on them. - it might be nice to define another pseudo-signal, call it SIGSTARTUP, along the lines of SIGEXIT. Now, the clear advantage of a fake "the shell has just started" signal is that it gives you a way (assuming that you can manage to import the function in the environment, as you always can if the process is just being spawned, and as you probably can if it is being started remotely by some type of daemon like say rshd) to execute something at shell initialisation time _regardless of whether the shell is a login shell or not_, and without the disgusting (both aesthetically and practically) overhead of an initialisation file per (every) shell, like .cshrc. I like the idea in the abstract, although I would want to think of some worthwhile concrete applications for it before I would lobby for its inclusion in rc -- I do not mean to suggest that there do not exist such; rather, at the moment I just don't have time to consider the matter at any length. (On a point of pure gustation, I do have to say I don't like the name much -- but on the other hand I can't think of a better one right now either: the obvious sigbegin doesn't appeal, and sigenter (as the antonym of sigexit) doesn't sound right either. Suggestions, any rcer's?) If SIGSTARTUP is always executed, there should be some way of telling whether or not a shell is interactive. This would let people make their root prompts something arbitrary, for example (after a few slips, I insist on having the machine name in mine). sigstartup, clearly, should always be executed. In the other direction lies zsh :). As a quite separate issue I'd like to address the question of telling whether or not the shell is interactive. sh has $-, and $- has many puzzling bugs, and inconsistencies between different versions of sh; these render a very pleasing concept very hard to use in practice. (For those of you who might not have come from an sh background, $- is supposed to contain exactly those `Boolean' command-line flags that are currently in effect; so e.g. if -e and -v were true, $- would be "ev".) I like this idea, and think it should be extended; I think there should be no `variables' that are accessible _from outside the shell source_, that is to someone using rc, that can't be examined and, if appropriate, set, by rc. So, for example, if -i is true (either explicitly from argv, or by implication), that should be testable from within rc, somehow. I have no syntax in mind at the moment. I also said "if appropriate, set"; I am not happy about the fact that rc has no "set" builtin (or equivalent mechanism). Byron, in the eventual revamp of rc -x, you might like to consider that it is not at all unreasonable to want to turn -x off and on at different points during execution. Clearly it's meaningless to suggest setting -l, but a case (perhaps a weak one) can be made for setting -i and -d, and -v and -e are fine candidates for toggling during the life of the shell. As well (and this is one of my beefs with sh's $-) I'd like the same mechanism, whatever it is, to say -c was true if the shell was currently executing a command from a -c argument: I needed that once, with sh. Now after that digression, let's return to Chris's comments: If SIGSTARTUP is always executed, there should be some way of telling whether or not a shell is interactive. This would let people make their root prompts something arbitrary, for example (after a few slips, I insist on having the machine name in mine). This is what I fail to follow; I don't understand why one needs to tell whether or not the shell is interactive in order to accomplish the goal of making a root prompt be something arbitrary. The best shot I have had so far at understanding this is that perhaps, Chris, you are an ex-csh user (in which case may I offer you my heartiest congratulations), and are inappropriately extrapolating csh experiences into the rc arena. Indeed, because csh is such a terrible program, it _is_ necessary to know whether or not the shell is interactive before one sets the prompt (since the damn-fool thing doesn't import the prompt from the environment, _and uses whether or not it has a non-null value as the criterion for deciding whether to print it_ -- so that willy-nilly setting the prompt in .cshrc results in prompts from non-interactive shells -- gaaack!!). I have some further comments about the idea of root prompt, su, and the sigstartup proposal, but I will defer them; this is long enough now and I would like to know what Chris really meant before going on. Happy rc'ing all! OK, John.