[comp.unix.sysv386] Virtual terminals

pjh@mccc.uucp (Pete Holsberg) (10/28/90)

Forgive me if the answers are in TFM, but it's in my office and I'm at home.

1)  How do I change the prompt that appears in a virtual terminal?

2)  How do I export my login environment (or modify the default one)
when I start a new VT?

Thanks a lot.

Pete
-- 
Prof. Peter J. Holsberg      Mercer County Community College
Voice: 609-586-4800          Engineering Technology, Computers and Math
UUCP:...!princeton!mccc!pjh  1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh@mccc.edu	     Trenton Computer Festival -- 4/20-21/91

pjh@mccc.uucp (Pete Holsberg) (10/29/90)

AT&T SV/386 R3.2.2

I have
	ALTSHELL=YES
in /etc/default/login, and the SHELL variableis set to /bin/ksh. 
However, when I invoke a new virtual terminal -- either with the hot key
or via 'newvt' -- the shell in the new VT does not execute /etc/profile
and it does not execute $HOME/.profile!  It *does* execute /etc/env and
$HOME/.env!  

I tried 
	newvt -e /bin/sh
but even that does not execute either /etc/profile or $HOME/.profile!!

Is this a bug or is there another of the seemingly endless flags that I
haven't discovered yet???

Thanks,
Pete
-- 
Prof. Peter J. Holsberg      Mercer County Community College
Voice: 609-586-4800          Engineering Technology, Computers and Math
UUCP:...!princeton!mccc!pjh  1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh@mccc.edu	     Trenton Computer Festival -- 4/20-21/91

woods@eci386.uucp (Greg A. Woods) (10/30/90)

In article <1990Oct29.000407.13391@mccc.uucp> pjh@mccc.uucp (Pete Holsberg) writes:
> AT&T SV/386 R3.2.2
>[....]
> However, when I invoke a new virtual terminal -- either with the hot key
> or via 'newvt' -- the shell in the new VT does not execute /etc/profile
> and it does not execute $HOME/.profile!  It *does* execute /etc/env and
> $HOME/.env!
>[....]

I'm not sure how it really works, but I would assume the new shell is
a child of newvt, thus inherits your current environment.  If ksh is
executing $ENV, then you should have an identical working environment,
as well as identical environment variables.

This is how I would want it to work too, thus a newvt would be the
same as a sub-shell.  I wouldn't want a sub-shell to re-execute
/etc/profile, nor $HOME/.profile, since most of that stuff I want done
only once per login session.  (Things like starting reminder daemons.)

If because of the way it works the new shell on the new vt isn't a
child of the current (or invoking) shell, I'd consider that a serious
bug.  (And to my memory of actually using ksh on AT&T SysVr3.2.2/386,
this bug doesn't exist, but that was a while ago....)

Anyway, why use VT's when you can use X?  :-)

Personally I prefer layers terminals (i.e. 5620's or [6,7]30's).
-- 
						Greg A. Woods

woods@{eci386,gate,robohack,ontmoh,tmsoft}.UUCP
+1-416-443-1734 [h]  +1-416-595-5425 [w]    VE3-TCP	Toronto, Ontario CANADA

les@chinet.chi.il.us (Leslie Mikesell) (10/30/90)

In article <1990Oct27.191111.9448@mccc.uucp> pjh@mccc.uucp (Pete Holsberg) writes:

>1)  How do I change the prompt that appears in a virtual terminal?

>2)  How do I export my login environment (or modify the default one)
>when I start a new VT?

If you just execute vtlmgr in your .profile, you will automatically get
a new shell with your login environment whenever you switch to a
new VT, with a prompt of "VT n> ", n being the number of the VT for
that session.  If you run ksh (and have ALTSHELL=YES in /etc/defaults/login)
you can probably do some tricks in the .kshrc if you want something
different at start-up.

Les Mikesell
  les@chinet.chi.il.us

jr@oglvee.UUCP (Jim Rosenberg) (10/30/90)

In <1990Oct27.191111.9448@mccc.uucp> pjh@mccc.uucp (Pete Holsberg) writes:

>1)  How do I change the prompt that appears in a virtual terminal?

>2)  How do I export my login environment (or modify the default one)
>when I start a new VT?

Hi Pete!

I'm not sure which UNIX you're running, but we run AT&T V.3.2.  We handle
virtual terminals by running a getty directly on /dev/console and /dev/vtxx.
AT&T seems to want me to run vtgetty.  vtgetty is most useful as fertilizer,
IMHO.  It makes all virtual terminals children of one session.  By running
a getty directly on the vtxx device, each virtual terminal acts as a
completely separate login.  Your login environment comes from .login or
.profile, etc., and you deal with the prompt just as you would from any
terminal.  You can set this up by editing /etc/inittab.
-- 
Jim Rosenberg             #include <disclaimer.h>      --cgh!amanue!oglvee!jr
Oglevee Computer Systems                                        /      /
151 Oglevee Lane, Connellsville, PA 15425                    pitt!  ditka!
INTERNET:  cgh!amanue!oglvee!jr@dsi.com                      /      /

kherron@ms.uky.edu (Kenneth Herron) (10/30/90)

woods@eci386.uucp (Greg A. Woods) writes:

>In article <1990Oct29.000407.13391@mccc.uucp> pjh@mccc.uucp (Pete Holsberg) writes:
>> However, when I invoke a new virtual terminal -- either with the hot key
>> or via 'newvt' -- the shell in the new VT does not execute /etc/profile
>> and it does not execute $HOME/.profile!  It *does* execute /etc/env and
>> $HOME/.env!

>I'm not sure how it really works, but I would assume the new shell is
>a child of newvt, thus inherits your current environment.  If ksh is
>executing $ENV, then you should have an identical working environment,
>as well as identical environment variables.

The new shell isn't a login shell, so it's not appropriate for it to
run /etc/profile or .profile.

I've always assumed without checking that shells started with vtlmgr use
the environment that existed when vtlmgr was run, and that newvt'd shells
use the current environment.

If you add the line "ALTSHELL=YES" to /etc/default/login then newvt and
vtlmgr will exec whatever your SHELL variable is set to.

Kenneth Herron

tr@samadams.princeton.edu (Tom Reingold) (11/12/90)

In article <1990Oct27.191111.9448@mccc.uucp> pjh@mccc.uucp (Pete
Holsberg) writes:

$ Forgive me if the answers are in TFM, but it's in my office and I'm at home.
$ 
$ 1)  How do I change the prompt that appears in a virtual terminal?
$ 
$ 2)  How do I export my login environment (or modify the default one)
$ when I start a new VT?

(Message outbox:1018)
From:     Tom Reingold <tr>
To:       pjh@mccc.uucp (Pete Holsberg)
Date:     Sun, 11 Nov 90 21:45:19 -0500
Subject:  Re: Virtual Terminals
Newsgroups: comp.sys.att,comp.unix.sysv386

In article <1990Oct29.000407.13391@mccc.uucp> you write:
$ AT&T SV/386 R3.2.2
$ 
$ I have
$ 	ALTSHELL=YES
$ in /etc/default/login, and the SHELL variableis set to /bin/ksh. 
$ However, when I invoke a new virtual terminal -- either with the hot key
$ or via 'newvt' -- the shell in the new VT does not execute /etc/profile
$ and it does not execute $HOME/.profile!  It *does* execute /etc/env and
$ $HOME/.env!  
$ 
$ I tried 
$ 	newvt -e /bin/sh
$ but even that does not execute either /etc/profile or $HOME/.profile!!
$ 
$ Is this a bug or is there another of the seemingly endless flags that I
$ haven't discovered yet???

Shells such as Bourne shell and Korn shell execute /etc/profile and
.profile only when argv[0] starts with a '-'.  The same is true for
C-shell and the .login file.  .profile or .login is only for things
specific to logging in, such as setting terminal type.  C-Shell has
.cshrc for things you want to do every time you start a shell.  Korn
shell has the ENV file.  Bounre shell has nothing.

If you use Korn shell, set the ENV variable to a file such as
$HOME/.environ and there you can set your prompt, path, etc.
--
        Tom Reingold
        tr@samadams.princeton.edu  OR  ...!princeton!samadams!tr
        "Warning: Do not drive with Auto-Shade in place.  Remove
	from windshield before starting ignition."