LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-04-2004, 04:27 AM   #1
gauge73
Member
 
Registered: Jan 2003
Location: Dallas, TX
Distribution: Fedora Core 4
Posts: 420

Rep: Reputation: 30
bash profile stuff


I'm trying to change a few things in my profile for bash. I've been told that the following files affect everyone...

/etc/bashrc
/etc/profile

I've also been told that the following files are run out of each individual's home directory and that they have an affect on only that individual...

~/.bashrc
~/.bash_profile
~/.bash_login

Now, I wanted to change my prompt initally, but there are other things I want to do in the future. I wasn't even able to change the prompt, though. I added the following lines to my ~/.bashrc file first...

PROMPT="[\u | "'$PWD'"] "
export PROMPT

This didn't do the trick. Therefore, I assumed that the ~/.bashrc file was not being called. I was told that it was called from the ~/.bash_profile file via the $BASH_ENV variable. So, I added the following lines to my ~/.bash_profile file...

BASH_ENV="$HOME/.bashrc"
export BASH_ENV

This still doesn't work. In fact, no changes I make to any of the bash-related files in my home directory seem to make a difference. I looked through the files in /etc that I listed above and none of them appear to actually set the $PROMPT variable. They use it in some conditionals, but never actually set it that I see.

What am I missing here? Is there another file or two that I don't know about or is the hierarchy different than I was told or what?
 
Old 01-04-2004, 05:34 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I looked through the files in /etc that I listed above and none of them appear to actually set the $PROMPT variable.
Try looking for "PS1".
 
Old 01-04-2004, 06:46 AM   #3
clar77
Member
 
Registered: May 2002
Location: Baltimore,MD
Distribution: RH8.0 FC1/2.6.1 MacOsX 10.3
Posts: 53

Rep: Reputation: 15
Re: bash profile stuff

Quote:
Originally posted by gauge73
This didn't do the trick. Therefore, I assumed that the ~/.bashrc file was not being called. I was told that it was called from the ~/.bash_profile file via the $BASH_ENV variable. So, I added the following lines to my ~/.bash_profile file...

BASH_ENV="$HOME/.bashrc"
export BASH_ENV

try putting:

source ~/.bashrc

in your ~/.bash_profile that should 'call' the file and activate aliases, etc...
 
Old 01-04-2004, 07:43 AM   #4
bones996
Member
 
Registered: Sep 2003
Location: Pennsylvania
Distribution: Debian Squeeze
Posts: 106

Rep: Reputation: 15
~/.bashrc is the file that is edited for changes for a single user, but you first have to exit the shell you are in before any changes will take effect.
 
Old 01-04-2004, 07:49 AM   #5
clar77
Member
 
Registered: May 2002
Location: Baltimore,MD
Distribution: RH8.0 FC1/2.6.1 MacOsX 10.3
Posts: 53

Rep: Reputation: 15
or simply source ~/.bashrc at the command line.
adding source ~/.bashrc to the .bash_profile will do it each time a new shell is opened.

and yeah this is just for a single user.
 
Old 01-04-2004, 12:31 PM   #6
Skyline
Senior Member
 
Registered: Jun 2003
Distribution: Debian/other
Posts: 2,104

Rep: Reputation: 45
As Unspawn mentioned, its Prompt String 1 you need to set in:

~/.bashrc

ie

PS1=”\u \w $”

check out the PS1 options for further "tuning".
 
Old 01-04-2004, 07:47 PM   #7
gauge73
Member
 
Registered: Jan 2003
Location: Dallas, TX
Distribution: Fedora Core 4
Posts: 420

Original Poster
Rep: Reputation: 30
Alrighty, I did what you guys said, and it's working now. I was just being a moron and was using PROMPT instead of PS1 and PS2. I knew better, but just forgot. Thanks a bunch for the help!

I have a new question, though... Which of the files is run when you log in (not every new shell, but when you actually log in) and which when you log out (again, not the closing of each shell, but when you actually log out)? I ask because I would like to have the login script kill my VNC server if it's running and have the logout script start it back up.
 
Old 01-05-2004, 01:54 AM   #8
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Login=(if they exist) /etc/profile, ~/.bash_profile, ~/.bash_login, and ~/.profile in that order.
Logout=~/.bash_logout

Check the man page under Invocation to make sure. All this stuff is in there. I think if you invoke a shell as a login it will run ~/.bash_logout on exit even if it isn't your initial login shell, but I'm not sure how to avoid that. If it's just an interactive shell, it'll read ~/.bashrc going in and ignore ~/.bash_logout going out.
 
  


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
Erasing the bash profile? AQG Linux - Security 6 07-06-2005 03:31 PM
bash: /etc/profile: Permission denied Kanon Linux - Newbie 4 01-21-2005 08:01 AM
bash and user profile maxoo Slackware 1 08-05-2004 06:19 AM
/etc/profile vs. /etc/bash.bashrc jbrashear Debian 3 03-11-2004 03:49 PM
where is my bash profile? bandofmercy Linux - General 3 04-08-2003 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:21 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