LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-21-2009, 05:49 AM   #1
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
Issue with .profile settings


Hi all,


I have a user environment which does not have .bash_profile, .bashrc and .bash_logout. But all the essential profile path are set in .profile.

when a default .bash_profile, .bashrc and .bash_logout are placed in home directory , it behaved the same.

i removed them and got struck. Now I have only .profile and it is not loading the settings. am able to login.

How can I make the environment to load the profile settings in $HOME/.profile to be loaded on login.
 
Old 01-21-2009, 06:31 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,342

Rep: Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746
Normally, .profile is for ksh, .bash_xxx are for bash shell.
If you're login shell is bash (see /etc/passwd), move .profile to .bash_profile and logout and back in again.
You may(!) need to alter the contents slightly. ksh and bash are highly compatible, but not quite 100%.
 
Old 01-21-2009, 07:52 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Read though the beginning of the bash info manual. It details which startup scripts are run. ~/.profile, ~/.bash_profile & ~/.bash_login are login scripts. You only need one of them present, and the one checked for first will be the one run. Most distro's use ~/.profile. If you sometimes use ksh or csh as your default shell, then check that shells documentation to see if ~/.profile would be run. In that case, either generic code would need to be used, or you want to use ~/.bash_profile or ~/.bash_login, so that it runs instead when you use bash as your default shell.

Use the login scripts to add to your PATH variable. ~/.bashrc is the bash startup script. It is run when you startup a new subshell, such as opening konsole or xterm. You don't want an instruction like "PATH=$PATH:/usr/local/bin" because if you open up a new subshell, the same path will be added on again.

Also, ~/.bashrc isn't run when you log on, but the ~/.bash_login or the ~/.profile script may source ~/.bashrc.

Last edited by jschiwal; 01-21-2009 at 07:55 PM.
 
Old 01-21-2009, 11:06 PM   #4
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
Thank you Chris and Jschiwal,

I agree with You, that .bash_profile is loaded in bash . I want to load .bash_profile as default , which inturn will call the .profile settings.
 
Old 01-22-2009, 09:56 AM   #5
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by ZAMO View Post
Thank you Chris and Jschiwal,

I agree with You, that .bash_profile is loaded in bash . I want to load .bash_profile as default , which inturn will call the .profile settings.
Add this to whatever file you know is running

Code:
if [ -f ~/.profile ]; then
    . ~/.profile
fi

Last edited by rweaver; 01-22-2009 at 09:58 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping profile settings with su in Slack ferventslacker Slackware 7 10-21-2008 07:38 AM
why do settings in /etc/profile.d/lang.sh get overridden? echowarpt Slackware 3 02-19-2007 08:13 PM
Thunderbird 1.5 loses my profile folder settings veggieboy4000 Linux - Software 1 05-13-2006 12:43 PM
ulimit settings in /etc/profile darn Linux - Newbie 1 02-10-2005 11:11 AM
switch profile/ settings in different locations raynet Linux - Wireless Networking 5 02-02-2005 11:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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