1823144 Members
3581 Online
109647 Solutions
New Discussion юеВ

terminal session in CDE

 
SOLVED
Go to solution
Ruben Cardenal
Frequent Advisor

terminal session in CDE

Hi,

I'd like to know where terminal sessions started from CDE are initialized, this is, is there any kind of .profile for those sessions?

TIA
3 REPLIES 3
Alex Glennie
Honored Contributor

Re: terminal session in CDE

Not sure what you mean terminal sessions but if you mean dtterms,hpterms and xterms launched from either a CDE icon/action or from a commmand line then the following may help :

none of the above Xclients/terminal emulators source the users .profile by default :

to do so you would need to either run them using -ls as an additional command line arg or vi $HOME/.Xdefaults and add :
*loginShell : True

eg
dtterm*loginShell : True

and then log out and back in again for the change to take effect.

see man dtterm etc for details.

Hartmut Lang
Trusted Contributor

Re: terminal session in CDE

In CDE the $HOME/.dtprofile is used to initialize your environment.
In .dtprofile you can set DTSOURCEPROFILE=true and the CDE session will also source your .profile (or .login).

By default this is not done.

Read the comments in .dtprofile and change your .profile as requested before you allow CDE to source your .profile.
This is important, because if CDE detects errors during sourcing your .profile the login will fail. Then you have to use a failsafe session and fix the errors in your .profile.

Hardy
Alex Glennie
Honored Contributor
Solution

Re: terminal session in CDE

The 2 methods listed above are different :

How to enable profile execution Per-UserSession
To enable $HOME/.profile or $HOME/.login execution for ONE user ONCE during the login process:

Create or modify : $HOME/.dtprofile


Find the following line to the end of this file :

DTSOURCEPROFILE=true


If the comment character "#" is removed, Xsession will source the $HOME/.profile (or $HOME/.login) file for the CDE session as a whole.

ie THE CDE SESSION / SHELL BUT if you open a dttermthis is a new shell and won't inherit envs etc listed in the .profile ! see eblow for detailed info :

How to enable profile execution Per-Terminal

Preliminarily, make changes to /etc/profile and $HOME/.profile such that when the user telnets or rlogins to the system, the environment is set as needed

To profile execution on ALL terminal emulators for ALL users:


Create or modify : /etc/dt/config/C/sys.resources


Add the following line to the end of this file :

*loginShell: True


Per-User Customization:

To profile execution on ALL terminal emulators for ONE user:


Create or modify : $HOME/.Xdefaults


Add the following line to the end of this file:

*loginShell: True


Per-Application Customization:


Create or modify : /etc/dt/app-defaults/Dtterm


Add the following line to the end of this file:

*loginShell: True


-- Or --


Create or modify : /etc/dt/appconfig/types/C/dt.dt


Add or modify the Dtterm entry to use the "-ls" command line option:

ACTION Dtterm
LABEL Terminal
ARG_COUNT 0
ICON Dtterm
TYPE COMMAND
WINDOW_TYPE NO_STDIO
EXEC_STRING /usr/dt/bin/dtterm -ls
DESCRIPTION The Terminal (Dtterm) action runs the desktop
Terminal Emulator application.
NOTE: These changes will take effect with the next login to CDE.


The $HOME/.Xdefaults file is sourced by CDE on login and any valid X Windows resources are incorporated into that CDE login session resources. The "loginShell" resource gets passed to applications and the terminal window applications interpret this and start login shells each time a terminal window is started. Login Shells by definition source the .profile or .login files.


The "*loginShell" resource will configure the terminal emulators (dtterm, hpterm, xterm) to behave as if the user had telnet-ed or rlogin-ed to the system.

This means that the default sequence of reading /etc/profile, etc. will occur each time a terminal window is opened.

The environment in the shell window will NOT be the same as that of the CDE session (dtsession).

From the dtterm man page:

-ls Start a login shell (the first character of argv[0] is a
dash), indicating to the shell that it should read the system's
profile and the user's .profile files (for ksh(1) and sh(1)), or
the system's csh.login, and the user's login. (for csh(1)).