LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   no .bashrc? (https://www.linuxquestions.org/questions/slackware-14/no-bashrc-64600/)

mattman 06-09-2003 03:52 PM

no .bashrc?
 
ok, this is really wierd. im creating new users with the adduser command, and there is no .bashrc in the home dir. ive tried making one, but for some reason it doesnt execute when a user logs in. but for some reason, when i launch a terminal in gnome, it does read it. anyone know how to get it to read it on login?

whansard 06-09-2003 03:55 PM

add this to your .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

mattman 06-09-2003 04:15 PM

lol, theres no .bash_profile either. and the problem isnt that the .bashrc isnt there, the problem is that it isnt executing

whansard 06-09-2003 04:21 PM

.bashrc isn't executed automatically. it's called from
another file.

add that to /etc/profile if you want.

cpv204 06-10-2003 07:57 AM

mattman, this may shed a little more light on your situation.

bash can start in two modes, a login shell and a non-login shell. When you login at the CLI, bash starts a login shell. When you are running an xterminal, bash starts a non-login shell.

In a login shell, bash looks at /etc/profile and the first of ~/.bash_profile, ~/.bash_login, and ~/.profile

In a non-login shell, bash looks at ~/.bashrc

That's why your users logging in at the CLI do not have the .bashrc commands execute, but when you open an xterm in gnome they do.

As whansard has pointed out, most people just source ~/.bash_profile from ~/.bashrc, so you get the same stuff no matter what kind of shell starts up.

snocked 06-10-2003 09:27 AM

Thanks for clearing that up.

whansard 06-10-2003 03:59 PM

the command to make bash run like it's logging in
is bash --login
suprisingly enough.


All times are GMT -5. The time now is 01:43 PM.