Message Board -  Archive

[ Login ] [ Create Account ]
[ Board List ] [ View Board ] [ Post Reply ]
  Author  Subject: Re: Login script

Posted on 09-15-2002 07:08 p.m. ET  reply

Original Poster: Mark Krentel

> Suppose I wanted a specific script to run every time I logged in.
> Where would I put it?

First, let me check that you do mean when you login, not when the
machine boots up, right?

Assuming it's login, this is controlled by your shell (probably bash)
and how you login. Sometimes your shell is treated as a login shell
and sometimes not. Assuming your shell is bash (a safe bet in Linux),
bash runs ~/.bash_profile for a login shell and ~/.bashrc for an
ordinary shell. So, .bash_profile might be the answer you're looking
for. But if it's something you want to do for every shell, like
setting aliases, then use .bashrc. See the INVOCATION section in man

But this distinction between login and non-login shells is old, tricky
and doesn't always make sense today. For example, telnet, ssh and the
console's text login: prompt give a login shell, xterms and su do not,
but "su -l" does. I'm not sure about a graphical login with xdm.

Can you tell me more specifically what you want the script to do?
It's likely that another file is a better place. For example, if you
want to start X applications, then you'd use .xinitrc (or .xsession
for xdm). I can't think of many things that make sense for only login


< Previous 1 Next >

Site Contents