LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-22-2003, 08:44 PM   #1
Radicalm16
Member
 
Registered: Jan 2003
Location: Venezuela
Distribution: Debian, Ubuntu
Posts: 75

Rep: Reputation: 15
Angry ~/.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.
 
Old 12-22-2003, 10:15 PM   #2
miaviator278
Member
 
Registered: Dec 2003
Location: Al-Diwania, Iraq (deployed)
Distribution: Slackware ONLY
Posts: 237

Rep: Reputation: 30
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..
 
Old 12-22-2003, 10:30 PM   #3
Radicalm16
Member
 
Registered: Jan 2003
Location: Venezuela
Distribution: Debian, Ubuntu
Posts: 75

Original Poster
Rep: Reputation: 15
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.

Last edited by Radicalm16; 12-22-2003 at 10:34 PM.
 
Old 12-22-2003, 10:49 PM   #4
Radicalm16
Member
 
Registered: Jan 2003
Location: Venezuela
Distribution: Debian, Ubuntu
Posts: 75

Original Poster
Rep: Reputation: 15
Solved.

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

Now, I dun know why it did work.

Radicalm16.
 
Old 12-23-2003, 02:12 AM   #5
core
Member
 
Registered: May 2003
Location: Berlin
Distribution: Slackware 9.1 Kernel: 2.6.4
Posts: 60

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

.bash_profile is not used in my configuration
 
Old 12-23-2003, 03:38 AM   #6
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
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
 
Old 12-23-2003, 06:10 AM   #7
kc00l
Member
 
Registered: Oct 2003
Location: France/Italy
Distribution: Slackware Current
Posts: 83

Rep: Reputation: 15
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. ""
 
Old 07-28-2009, 11:22 AM   #8
Jerry Davis
LQ Newbie
 
Registered: Dec 2007
Posts: 2

Rep: Reputation: 0
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
 
Old 07-28-2009, 11:51 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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.
 
Old 07-28-2009, 09:39 PM   #10
vik
Member
 
Registered: Apr 2008
Distribution: Gentoo, FreeBSD
Posts: 225
Blog Entries: 8

Rep: Reputation: 50
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get next executed line phuna Programming 2 07-08-2005 12:05 AM
.bash_profile overwritten on login to root Awesome Dude Linux - Newbie 1 08-23-2004 02:41 PM
.bashrc not being executed, why? realos Linux - Newbie 1 12-20-2003 07:46 PM
.bash_logout does not get executed nearfar Linux - Newbie 3 10-17-2003 11:40 AM
.xinitrc isn't executed hampel Linux - Software 5 08-06-2003 03:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration