LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   ~/.bash_profile not being executed at login (https://www.linuxquestions.org/questions/slackware-14/%7E-bash_profile-not-being-executed-at-login-128232/)

Radicalm16 12-22-2003 08:44 PM

~/.bash_profile not being executed at login
 
this is what my ~/.bash_profile has:

offtopic@pits:~$ cat .bash_profile
#!/bin/sh

PATH=$PATH:$HOME/things/bin

and it's not working.

offtopic@pits:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/opt/kde/bin:/usr/lib/qt-3.1.2/bin:/usr/share/texmf/bin

Can anyone tell me what's going on???


thnx.
Radicalm16.

miaviator278 12-22-2003 10:15 PM

check your /etc/profile
file and it problably links somewhere around line 10 - 15 to .inputrc instead of .bashrc, you can leave that and add the line

source ~/.bashrc

check out the man page /etc/profile (man /etc/profile) it tells you everything else. you may or may not need to know.

also please post your results, whether this works or not..

Radicalm16 12-22-2003 10:30 PM

If I force it from /etc/profile it should work but I'm posting 'cuz I have other Slack box with the same configuration (~/.bash_profile with the same lines on it and no ~/.bashrc) and it's working there...

BTW I also tried to put the script inside ~/.bashrc ( and source $HOME/.bashrc in ~/.bash_profile) and didn't work neigther.

Quote from the man pages for bash at the Invocation section:
Quote:

When bash is invoked as an interactive login shell, or as
a non-interactive shell with the --login option, it first
reads and executes commands from the file /etc/profile, if
that file exists. After reading that file, it looks for
~/.bash_profile, ~/.bash_login, and ~/.profile, in that
order, and reads and executes commands from the first one
that exists and is readable.
If I'm not missreading what I'm doing is right (I just dun know why it's not working :( ), and I'm pretty sure it's a loggin shell because I'm login off and on in my console ;).


Radicalm16.

Radicalm16 12-22-2003 10:49 PM

Solved.

I just made a sym link of my ~/.bash_profile as ~/.profile

Now, I dun know why it did work.:confused:

Radicalm16.

core 12-23-2003 02:12 AM

afaik:
.bashrc is read by non-login shells
.bash_login is read by login-shells

.bash_profile is not used in my configuration :D

slackie1000 12-23-2003 03:38 AM

Just for information...
there is a question of priority - that I don't know very well.
In fact, i had the same problem.
My solution was : erase the .profile file... If this file exist, somehow .bash* is ignored..
I didn't understand .... But now it is working how I want..
Regards
Slackie

kc00l 12-23-2003 06:10 AM

Re: ~/.bash_profile not being executed at login
 
Quote:

Originally posted by Radicalm16
this is what my ~/.bash_profile has:

offtopic@pits:~$ cat .bash_profile
#!/bin/sh

PATH=$PATH:$HOME/things/bin

and it's not working.

offtopic@pits:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/opt/kde/bin:/usr/lib/qt-3.1.2/bin:/usr/share/texmf/bin

Can anyone tell me what's going on???


thnx.
Radicalm16.

mmh...

PATH="$PATH:$HOME/things/bin"

I might be wrong, but in my .bash_profile I've got my PATH variable between double quotes,
i.e. ""

Jerry Davis 07-28-2009 11:22 AM

on ubuntu, it appears non-login shells get /dev/null 'd
 
I looked in /etc/profile and found out it executes a file name /etc/bash.bashrc. in bash.bashrc there is a line right after the line that says: # If not running interactively, don't do anything

if [ -z "$PS1" ] && return

I changed this to:

# If not running interactively, don't do anything
if [ -z "$PS1" ]; then
if [ -r ~/.bash_profile ]; then
. ~/.bash_profile
fi
return
fi


and now it works the way I think it should. I have a .bash_profile that needs to run once to set up some at jobs, then .bashrc as many times as I use the terminal of course. I won't put this setup at jobs in the .bashrc file as i would get multiple at jobs everytime I executed another xterm.

anyway, if anyone has a better way on ubuntu let me know, because I have a sneaking suspicion that everytime I upgrade the o/s, it will overwrite what I did in /etc/bash.bashrc

jerry

onebuck 07-28-2009 11:51 AM

Hi,

Welcome to LQ & the Slackware forum.

You should look at the post date. A six year old thread. :(

You could setup a conditional in your '.bash_profile' that would test then perform your settings within the '.bashrc' conditionally.

You could post within the Ubuntu forum to point out what you are attempting. Not only would you get relative replies from Ubuntu people but they too could respond back possible other methods.

vik 07-28-2009 09:39 PM

I think you want to create your bash customizations in a .bash_login file. You could do ln -s .bashrc .bash_login if you wanted to use the same settings for non-interactive and interactive: you might want to use some caution if Ubuntu does a lot of customizations like checking for mail, etc. as this could screw up remote logins.


All times are GMT -5. The time now is 03:55 AM.