LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.

Notices


Reply
  Search this Thread
Old 07-03-2004, 11:05 AM   #1
mrpringle
Member
 
Registered: Jul 2004
Posts: 31

Rep: Reputation: 15
SUSE 9.1 and .bash_profile (where is it??)


Hi,
I have been using fedora and mandrake and in each the .bash_profile file was in the home directory. In SUSE 9.1 i can't seem to find it or it's equivalent.

Does anyone know where i can find the file, or how i can set environment variables such as get java to work globally. What I am saying probably doesn't make sense so to rephrase it i'll just say i want to type javac and get the javac command to work without having to be in the j2sdk1.4.2_-3_4xxxxxxxxxxxxxx_xxxxxxxxx_xxxxxxxxxx_xxxxxxxxx_xxxxxxxx.xx_x.x_x.xxxx directory. You get the point :-)
 
Old 07-03-2004, 11:16 AM   #2
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
If $HOME/.bash_profile doesn't exist you can create it with a text editor like gedit or kedit
 
Old 07-06-2004, 08:25 AM   #3
mrpringle
Member
 
Registered: Jul 2004
Posts: 31

Original Poster
Rep: Reputation: 15
hi, can you tell me how to create this file and what should be in it. How come it isn't created during the install process.

Thanks
 
Old 07-06-2004, 11:45 AM   #4
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
It's just a plain text file. It's one of the files bash reads when you open a shell (read man bash). Put in it commands that you want to run every time you open a terminal. I put this in mine
Code:
export PATH=/home/andy/bin:/bin:/usr/bin:/usr/X11R6/bin
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/X11R6/lib/pkgconfig
export LFS=/mnt/lfs
export PS1='\u:\w\$ '
You should put in it whatever you want.
 
Old 07-06-2004, 11:50 AM   #5
rshaw
Senior Member
 
Registered: Apr 2001
Location: Perry, Iowa
Distribution: Mepis , Debian
Posts: 2,692

Rep: Reputation: 45
you could create it, but suse most likely ignore it. suse doesn't use .bash_profile its .bashrc
 
Old 07-06-2004, 01:36 PM   #6
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
Quote:
Originally posted by rshaw
you could create it, but suse most likely ignore it. suse doesn't use .bash_profile its .bashrc
/me pokes rshaw in the eye.
.bash_profile works perfectly here. It loads with login shells (which .bashrc does not do by default), and then I source .bashrc from it to load aliases and prompts in the login shells.
 
Old 07-06-2004, 01:59 PM   #7
rshaw
Senior Member
 
Registered: Apr 2001
Location: Perry, Iowa
Distribution: Mepis , Debian
Posts: 2,692

Rep: Reputation: 45
ouch. never tried adding a bash_profile. thought that all lived in .profile
 
Old 07-07-2004, 08:01 AM   #8
mrpringle
Member
 
Registered: Jul 2004
Posts: 31

Original Poster
Rep: Reputation: 15
I don't know what SUSE uses, but where do all the environment variables go. For example when i open up the terminal and type javac it finds the javac program. Somehow this java folder must have been added to the environment variables, but where.

Thanks
 
Old 07-07-2004, 11:13 AM   #9
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
It could be set from one of a number of sources, but most likely from a startup or login script such as /etc/profile /etc/bash* or /etc/init.d/something/something*. I think the startup scripts would modify only root's environment, though.

Basically any script containing a line such as "export VAR=value" will modify your environment (within that shell and its children).
 
Old 07-07-2004, 11:31 AM   #10
mrpringle
Member
 
Registered: Jul 2004
Posts: 31

Original Poster
Rep: Reputation: 15
i'm not using root, i'm using a normal login for general use.
 
Old 07-07-2004, 11:57 AM   #11
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
In my SuSE9.0, Java paths are set from /etc/profile.d/alljava.sh
When I login, /etc/profile is loaded, which in turn runs /etc/profile.d/alljava.sh

afaik, most of the stuff that happens when you log in will start with /etc/profile, ~/.profile, and ~/.bash_profile
 
Old 07-08-2004, 12:38 AM   #12
mrpringle
Member
 
Registered: Jul 2004
Posts: 31

Original Poster
Rep: Reputation: 15
thanks. One last request. I uninstalled mozilla 1.6 (the rpm that came with suse 9.1) and installed mozilla 1.7 from the mozilla website. Now to execute mozilla i have to be in the mozilla path. How can I fix this up so mozilla is an environment variable
 
Old 07-08-2004, 12:53 AM   #13
mrpringle
Member
 
Registered: Jul 2004
Posts: 31

Original Poster
Rep: Reputation: 15
oh, and this code in the /etc/profile, file

if test -d /etc/profile.d -a -z "$PROFILEREAD" ; then
for s in /etc/profile.d/*.sh ; do
test -r $s && . $s
done
unset s
fi

Does this execute all the scripts in /etc/profile.d?
 
Old 07-08-2004, 02:29 PM   #14
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
Quote:
One last request. I uninstalled mozilla 1.6 (the rpm that came with suse 9.1) and installed mozilla 1.7 from the mozilla website. Now to execute mozilla i have to be in the mozilla path. How can I fix this up so mozilla is an environment variable
You could add the new mozilla or mozilla bin directory to your path: export PATH=$PATH:/opt/Mozilla/mozilla (or whatever the path is)

Quote:
Does this execute all the scripts in /etc/profile.d
yes, as long as it's a readable file (test -r $s) and profile.d exists as a directory (test -d /etc/profile.d) and you don't already have a $PROFILEREAD variable set (test -z $PROFILEREAD)
I'm not sure what $PROFILEREAD is, so it's possible that environment variables come from another source when it's set.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
.bash_profile praveenv Linux - Newbie 3 08-14-2004 01:58 PM
.bash_profile wildcat22 Linux - General 3 04-13-2004 08:08 PM
need .bash_profile example true_atlantis Slackware 2 02-07-2004 07:27 PM
.bash_profile sikandar Linux - Software 9 08-31-2003 11:01 AM
.bash_profile Wasim Haider Linux - General 2 09-16-2002 08:12 AM

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

All times are GMT -5. The time now is 09:51 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration