From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from doolittle.vetsci.su.OZ.AU ([129.78.148.2]) by hawkwind.utcs.toronto.edu with SMTP id <2720>; Sun, 28 Jun 1992 16:15:53 -0400 Received: by doolittle.vetsci.su.oz.au id <49162>; Mon, 29 Jun 1992 06:15:34 +1000 From: John (_You_ hide, they seek.) Mackin Date: Sun, 28 Jun 1992 16:00:25 -0400 To: The rc Mailing List Subject: rc initialisation Message-ID: <199206290600.18625.rc.balid@vetsci.su.oz.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{ A file of rc tricks would be a good idea, especially since everyone seems to have forgotten one of my favourites. Chris's suggestion for getting initialisation to happen on every new interactive rc is: fn prompt { if (! ~ $cpid $pid) {cpid=$pid; ... } } This code is correct, but I think that most of the time this is not what you want. The original poster was looking for a way to get an stty to happen when they fired off a new xterm. If you use this method, then the stty will happen not only at the very beginning of the xterm, but every time a new interactive rc is spawned in the xterm. My counter-proposal is: fn prompt { do the initialisation; fn prompt } This differs from Chris's in that the initialisation is definitely only executed -once-, and in that the prompt function doesn't hang around to clutter the environment and slow your shells down. I think that in the huge majority of cases, these differences will be advantages. For a concrete example, here's the file in $home/bin that spawns my window manager: #!/home/john/bin/rc fn prompt { stty new fn prompt } pathos $0 $* On other matters mentioned recently, very briefly: (1) Chris is 100% correct in his statement that no changes need be made to rc to deal with any initialisation at all, with the possible exception of rsh; and also 100% correct that we shouldn't try to change rc to `work around' rsh. (If we're sufficiently clever we can get rsh to work right most of the time, I think.). (2) Don't even THINK about making all rc's source .rcrc. If we want that kind of braindeath, we can use zsh. The whole point of the way rc works is that subshells -are- completely initialised from the environment. OK, John.