[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: running scripts when logging in (via X)



On Tue, Nov 30, 2004 at 09:04:17AM -0500, Mark D. Hansen wrote:
> When I reboot my Debian box, the login comes up in an X environment.  I
> notice that my login scripts (e.g., /etc/profile, .bash_profile) do not run.
> 
> How to I get these scripts to run when I login via X ??



/etc/profile and ~/.bash_profile are only supposed to run when you first login,
rather than every time you start a new shell or open a new xterm.

~/.bashrc is run every time you start a new shell.



Are you sure that the display managers like "xdm", "gdm", "kdm" don't run
/etc/profile or ~/.bash_profile when you login ?

I tried with xdm, and apparently it _does_ run both of these.  I think it's a
bit weird that it runs ~/.bash_profile!  apparently this is because the
Xsession script is executed using bash.

I assume that /etc/profile and ~/.bash_profile get run no matter which display
manager you use since Xsession is common to all of them.



Perhaps you were expecting the profile scripts to get run every time you open
an xterm?  they don't.  Put stuff you want to be run every time you open an
xterm in ~/.bashrc instead.

Creating a new "screen" apparently counts as "logging in" - it does run
/etc/profile and ~/.bash_profile.  That seems a bit bogus.

(in case you don't know what screen is, it's a useful program that prevents
your terminals / shells dying if X dies, among other things!  see "apt-cache
show screen")



Sam



Reply to: