Configure $PATH in /.bash_profile or /etc/paths?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Configure $PATH in /.bash_profile or /etc/paths?
# 1  
Old 02-23-2012
Configure $PATH in /.bash_profile or /etc/paths?

Hi - I am trying to include the MSQ.exe that I have downloaded for the sake of learning. My current /.bash_profile file reads:


PATH=/Library/Frameworks/Python.framework/Versions/3.1/bin:/Applications/XAMPP/xamppfiles/bin:$PATH
export PATH

-----------------------------------

interestingly, another file, /etc/paths reads:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

-----------------------------------


at the prompt, if I$ echo $PATH I get


/Library/Frameworks/Python.framework/Versions/3.1/bin:/Applications/XAMPP/xamppfiles/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin


almost a combination of the two minus the /usr/X11/bin.


What must I do to include all of the $PATH variable into either /.bash_profile or /etc/paths? Which one do I put it in? Which ever one it is, that is where I will put the path the the MSQ.exe file.

Lastly, what is telling the OS where to find the $PATH variable in the first place? It seems like there must be some instruction that is causing the OS to look in those two different places.

---------- Post updated at 04:43 AM ---------- Previous update was at 04:41 AM ----------

Thanks for any and all help on this!
# 2  
Old 02-23-2012
Quote:
what is telling the OS where to find the $PATH variable in the first place?
Is OS specific...

But generally in UNIX you would have a default profile in /etc which is read first, so you would set here at a minimum for all purpose except administration stuff and customize the extra needs in the users $HOME/.profile

Since you did not give your OS, there is not much more to say...
# 3  
Old 02-23-2012
Thanks! My OS is Mac OSX 10.6. Thanks for explaining where I need to put the path to the MSQ.exe.

Interestingly, on another computer with Mac OSX 10.5 if I

$ echo $PATH

I get:

[stuff in /.profile]:[stuff in /etc/paths]:[stuff in a third location]

I guess I am not understanding what is controlling the OS to look in these three locations once again to determine the collective path. Thanks.
# 4  
Old 02-23-2012
It's not one giant thing. Anything can and does set it, and passes on copies of these changes to whatever it creates in turn. To get a complete understanding of how this PATH is set you'd need to know everything that changed it from the point your system runs init until the point your window manager creates your shell -- anything along the way between those two can affect PATH.

Only after all that happens, does your shell exist to start changing it too...

1) Your window manager creates a shell prompt. What PATH does your window manager have? Who knows. Whatever it had for whatever reason, your shell gets a copy.
2) shell reads /etc/profile. This is a script -- they can do anything they want in there, like read other files, set a special path for root only, or anything else you can imagine.
3) shell reads ~/.bashrc. This is also a script.

Last edited by Corona688; 02-23-2012 at 05:44 PM..
# 5  
Old 02-23-2012
Thanks Corona688

Thank you, Corona688. I think your explanation covered every base I could expect to find in such a complicated concept. I will have to woodshed a bit at this point to truly understand what you said. Because you pointed me in the right directions as far as what to look at as well as the concept behind a very dynamic path variable, I will be able to eventually understand. Thanks!

---------- Post updated at 06:14 PM ---------- Previous update was at 05:57 PM ----------

Edit: I found what seems to be a comprehensive explanation of how PATH is constructed, at least in MAC OSX 10.5 and up. This link below explains that a script called path_helper located in /etc/profile looks at text files in /etc to construct the PATH and MANPATH variables.


softec.lu/site/DevelopersCorner/MasteringThePathHelper

Last edited by Alexander4444; 02-26-2012 at 06:19 PM.. Reason: help poster
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Library/header path for ./configure

Hello, I am always confused about adding library path for ./configure when compiling software under Linux Debian based OS. For example the README of the software tells --with-boost=PATH specify directory for the boost header files --with-mpi=PATH specify prefix directory for... (4 Replies)
Discussion started by: yifangt
4 Replies

2. UNIX for Dummies Questions & Answers

.bash_profile question

Hello everyone, I'm trying to set my .bash_profile to change my primary prompt from this: banbatchtest1v:MCPPRD:~>to this: banbatchtest1v:MCPPRD:/home/rcarvall> Here's what my .bash_profile looks like right now: # .bash_profile # Get the aliases and functions if ; then .... (2 Replies)
Discussion started by: galileo1
2 Replies

3. Solaris

Removing Dead Paths And Unusable Path Solaris 9

Hi, One of our Solaris servers was peviously zoned and connected to 2 seperate arrays, one HP and the other EMC. The server is now only connected to the EMC. The sever has x2 single port HBA's. When running cfgadm I see the following: root@qwicprod /dev/rdsk]# cfgadm -al Ap_Id Type... (6 Replies)
Discussion started by: jamba1
6 Replies

4. UNIX for Advanced & Expert Users

bash_profile or .profile

Hi, happy new year. on AIX 6.1 , for user oracle , there are two files : bash_profile and .profile I do not know which one is executed when login ? How to know , More over in both of them we have : in .profile : ORACLE_HOME=/appli/oracle/product/10.2.0/db_1... (5 Replies)
Discussion started by: big123456
5 Replies

5. Solaris

configure: error: no acceptable ld found in $PATH

When i configure apache(2.2.15) on solaris-8 server it producing following error <configure: error: no acceptable ld found in $PATH configure failed for srclib/apr > please help me any to fix this error. :confused: ---------- Post updated at 09:44 PM ---------- Previous update was... (0 Replies)
Discussion started by: kalpeer
0 Replies

6. Solaris

Unavailable/Slow Network Paths in $PATH

At work, I'm in a Solaris environment working with csh, and $PATH is populated with anywhere between 10 and 20 entries. Last week, every command I issued (even "ls") took several seconds, if not an entire minute, to run. Once I moved "/home/sybase/bin" to the end of $PATH, certain commands... (2 Replies)
Discussion started by: acheong87
2 Replies

7. Shell Programming and Scripting

.bash_profile problem

Hi Guys, I modified my .bash_profile script , and tried to change the prompt. Following is the line of code in my .bash_profile script. export PS1=" \W " But I get the output as: \W This appears to be my prompt now. Any idea what should be done.. Thanks! (0 Replies)
Discussion started by: nua7
0 Replies

8. Solaris

How to add new paths to $PATH

Hi all, I downloaded a tarball of coreutils .... extracted only to find out that i had to build it... But when i executed ./configure, this is what i got checking build system type... i386-pc-solaris2.11 checking host system type... i386-pc-solaris2.11 configure: autobuild project... GNU... (2 Replies)
Discussion started by: wrapster
2 Replies

9. UNIX for Dummies Questions & Answers

Unrecognized Path in .bash_profile

Dear experts, I have installed Ruby in the following directory: $ pwd /home/ewijaya/.ruby $ ls bin lib share And I have also stated the PATH in my bash_profile like this: # .bash_profile # Get the aliases and functions if ; then . ~/.bashrc (1 Reply)
Discussion started by: monkfan
1 Replies

10. UNIX for Dummies Questions & Answers

Editing $PATH in .bash_profile

Hello, I'm trying to add my bin directory to my path by editing the .bash_profile. I'm adding the following: PATH=$HOME/bin But then when I type in "echo $PATH" my bin directory is not added. Do I need to do something to make this take affect or am I going about this wrong. :confused: ... (9 Replies)
Discussion started by: Atama
9 Replies
Login or Register to Ask a Question