rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re:  subshell, interactive, login, etc
@ 1992-06-26  1:41 Donn Cave
  1992-06-26  2:07 ` Scott Schwartz
  1992-06-26  8:10 ` Matthew Farwell
  0 siblings, 2 replies; 9+ messages in thread
From: Donn Cave @ 1992-06-26  1:41 UTC (permalink / raw)
  To: rc

| Every rc sources .rcrc, but before doing this defines
| certain variable (say $mode) to have certain values
| depending on the mode. 
|
| Then you can do in .rcrc:
|
|   switch ($mode){
|     case login;  . $home/rc/login;
|     case inter;  . $home/rc/inter;
|     case inter_login; . $home/rc/inter; . $home/rc/login;
|   }

I think something like this is needed, recognizing that as we find more
alternatives to the console login, properly initializing a new shell process
becomes more complex.

I think I recall that the original inspiration for this was an stty(1)
needed for a new xterm-invoked rc; this process will inherit environment
variables, so you wouldn't want to set "path" and so forth as if it were
a login, but you wouldn't want to have every interactive rc process run
stty(1).

The easiest and most general way to handle this one might be to use the
ENV concept from ksh.  Window managers and the like could set
ENV = $home/newtty.rc, and that script would be responsible for clearing
ENV so that further rc's aren't plagued by it.  ENV would normally not
be set, so rc scripts wouldn't source anything at all, but it would probably
be good to insure that by having non-interactive shells ignore ENV.

I've complained in the past that rshd invokes one's shell without the
leading minus sign that would make it a login shell, so .rcrc (or .profile,
or whatever) doesn't get run.  This makes it hard to invoke something
that's not in a system standard execution path, via rsh.

There may be no good way to fix that problem, but the best of the bad ways
might be to have rc expect a certain environment variable, and run .rcrc
if it's not there.

	Donn Cave, University Computing Services, University of Washington
	donn@cac.washington.edu


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

* Re: subshell, interactive, login, etc
  1992-06-26  1:41 subshell, interactive, login, etc Donn Cave
@ 1992-06-26  2:07 ` Scott Schwartz
  1992-06-26  8:10 ` Matthew Farwell
  1 sibling, 0 replies; 9+ messages in thread
From: Scott Schwartz @ 1992-06-26  2:07 UTC (permalink / raw)
  To: Donn Cave; +Cc: rc


| I've complained in the past that rshd invokes one's shell without the
| leading minus sign that would make it a login shell, so .rcrc (or .profile,
| or whatever) doesn't get run.  This makes it hard to invoke something
| that's not in a system standard execution path, via rsh.

I've been using this lately.  It seems like an adequate workaround.

#!/bin/rc -p
# usage: rrc [-n] host cmd
bg=(); quietly=(); sanely='>[3=] >[4=] >[5=] >[6=] >[7=]';
host=$1; shift
if (~ -n $host) {
    bg='&'
    quietly='>[0]/dev/null >[1=0] >[2=0]' 
    host=$1; shift
}
{ whatis PATH DISPLAY TERM TERMCAP TERMINFO >[2]/dev/null
  echo exec $sanely
  echo . .rcrc
  echo '{' $* '}' $quietly $bg 
  exit
} | rsh $host exec /bin/rc



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

* Re:  subshell, interactive, login, etc
  1992-06-26  1:41 subshell, interactive, login, etc Donn Cave
  1992-06-26  2:07 ` Scott Schwartz
@ 1992-06-26  8:10 ` Matthew Farwell
  1 sibling, 0 replies; 9+ messages in thread
From: Matthew Farwell @ 1992-06-26  8:10 UTC (permalink / raw)
  To: donn; +Cc: rc

In article <9206260141.AA07285@carson.u.washington.edu> you write:
>| Every rc sources .rcrc, but before doing this defines
>| certain variable (say $mode) to have certain values
>| depending on the mode. 
>|
>| Then you can do in .rcrc:
>|
>|   switch ($mode){
>|     case login;  . $home/rc/login;
>|     case inter;  . $home/rc/inter;
>|     case inter_login; . $home/rc/inter; . $home/rc/login;
>|   }
>
>I think something like this is needed, recognizing that as we find more
>alternatives to the console login, properly initializing a new shell process
>becomes more complex.
>
>I think I recall that the original inspiration for this was an stty(1)
>needed for a new xterm-invoked rc; this process will inherit environment
>variables, so you wouldn't want to set "path" and so forth as if it were
>a login, but you wouldn't want to have every interactive rc process run
>stty(1).
>
>The easiest and most general way to handle this one might be to use the
>ENV concept from ksh.  Window managers and the like could set
>ENV = $home/newtty.rc, and that script would be responsible for clearing
>ENV so that further rc's aren't plagued by it.  ENV would normally not
>be set, so rc scripts wouldn't source anything at all, but it would probably
>be good to insure that by having non-interactive shells ignore ENV.

; ls -l /bin/rc /bin/-rc
-rwxr-xr-x   3 bin      bin         63660 Feb 19 13:17 /bin/-rc*
-rwxr-xr-x   3 bin      bin         63660 Feb 19 13:17 /bin/rc*
; fn rc { mode=subshell -rc $* }

Then put something like

if (! $mode ~ subshell) {
	test -f $MAIL && echo You have mail.
} else {
	prompt=('subshell; ' '>')
}

in your .rcrc.  Well, that will work when you do it interactively
anyway.

Dylan.

-- 
It is no coincidence that in no known language does the phrase 'As
pretty as an Airport' appear -- Douglas Adams


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

* Re: subshell, interactive, login, etc
@ 1992-06-26 13:57 Matthew Farwell
  0 siblings, 0 replies; 9+ messages in thread
From: Matthew Farwell @ 1992-06-26 13:57 UTC (permalink / raw)
  To: malte; +Cc: rc

In article <9206261033.AA05577@dahlie.techfak.uni-bielefeld.de> you write:
>drazen@vlsi.cs.caltech.edu (D. Borkovic) writes:
>
>	Every rc sources .rcrc, but before doing this defines
>	certain variable (say $mode) to have certain values
>	depending on the mode. 
>
>If this is seriously considered to be incorporated, the recent rc version will
>be the last I use. There has never been an uglier, more resource waisting or
>more problem causing mechanism than that. I fought serious wars to convince
>csh users to switch to rc and now this !

Now that you come to mention it, I think it'd be the same for me too.

Dylan.

-- 
It is no coincidence that in no known language does the phrase 'As
pretty as an Airport' appear -- Douglas Adams


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

* Re: subshell, interactive, login, etc
@ 1992-06-26 10:33 malte
  0 siblings, 0 replies; 9+ messages in thread
From: malte @ 1992-06-26 10:33 UTC (permalink / raw)
  To: rc

drazen@vlsi.cs.caltech.edu (D. Borkovic) writes:

	Every rc sources .rcrc, but before doing this defines
	certain variable (say $mode) to have certain values
	depending on the mode. 

If this is seriously considered to be incorporated, the recent rc version will
be the last I use. There has never been an uglier, more resource waisting or
more problem causing mechanism than that. I fought serious wars to convince
csh users to switch to rc and now this !

NEVER!

Malte.



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

* Re: subshell, interactive, login, etc
@ 1992-06-26  3:57 Alan Watson
  0 siblings, 0 replies; 9+ messages in thread
From: Alan Watson @ 1992-06-26  3:57 UTC (permalink / raw)
  To: rc

I have a work-around for the problems with rsh; my `login shell' is
actually this rc script (called, unsurprisingly, rc-login):

#! /usr/users/alan/bin/rc
path = ( /usr/users/alan/bin $path )
exec rc -l $*


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

* Re: subshell, interactive, login, etc
  1992-06-26  0:26 D. Borkovic
  1992-06-26  0:42 ` Scott Schwartz
@ 1992-06-26  1:39 ` Chris Siebenmann
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Siebenmann @ 1992-06-26  1:39 UTC (permalink / raw)
  To: rc

 The only problem not currently addressable in rc as it stands is
rsh, and I think rsh is its own problem and rc need not try to
solve that particular mess.

	- cks


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

* Re: subshell, interactive, login, etc
  1992-06-26  0:26 D. Borkovic
@ 1992-06-26  0:42 ` Scott Schwartz
  1992-06-26  1:39 ` Chris Siebenmann
  1 sibling, 0 replies; 9+ messages in thread
From: Scott Schwartz @ 1992-06-26  0:42 UTC (permalink / raw)
  To: D. Borkovic; +Cc: rc


| What do people out there think about this:
| 
| Every rc sources .rcrc, but before doing this defines
| certain variable (say $mode) to have certain values
| depending on the mode. 

How about this instead:  every rc evaluates a function, rc_init, if
defined, when it starts up.  (Before or after .rcrc, if a login shell?)
This would preserve a nice property of the current scheme, that you
don't need to read .rcrc just to start a shell.

My dream fix: user defined read-eval-print loops.  Scheme-shell anyone?



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

* subshell, interactive, login, etc
@ 1992-06-26  0:26 D. Borkovic
  1992-06-26  0:42 ` Scott Schwartz
  1992-06-26  1:39 ` Chris Siebenmann
  0 siblings, 2 replies; 9+ messages in thread
From: D. Borkovic @ 1992-06-26  0:26 UTC (permalink / raw)
  To: rc


What do people out there think about this:

Every rc sources .rcrc, but before doing this defines
certain variable (say $mode) to have certain values
depending on the mode. 

Then you can do in .rcrc:

  switch ($mode){
    case login;  . $home/rc/login;
    case inter;  . $home/rc/inter;
    case inter_login; . $home/rc/inter; . $home/rc/login;
  }

Well, I did not think much about the values (inter_login looks
ugly), but I hope you get the idea.

Drazen


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

end of thread, other threads:[~1992-06-26 14:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-06-26  1:41 subshell, interactive, login, etc Donn Cave
1992-06-26  2:07 ` Scott Schwartz
1992-06-26  8:10 ` Matthew Farwell
  -- strict thread matches above, loose matches on Subject: below --
1992-06-26 13:57 Matthew Farwell
1992-06-26 10:33 malte
1992-06-26  3:57 Alan Watson
1992-06-26  0:26 D. Borkovic
1992-06-26  0:42 ` Scott Schwartz
1992-06-26  1:39 ` Chris Siebenmann

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