# Executable file paths in the Bash shell



## will103 (Nov 4, 2003)

Hi, I have recently installed Mac OS 10.3, and am getting to grips with the Bash shell. I compiled the Nano text editor and all went well until I tried to execute it in Bash. I received the following error message

wills-Computer:~ will$ nano
-bash: nano: command not found

Now, it would execute if I included the full file path i.e.

/usr/local/bin/nano

So, I figured that I needed to tell Bash where to look. After some searching on this site and around the web, I created a .bashrc file in my home directory. In this file I included the following

PATH=$PATH:/bin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH

According to what I have read this should have solved the problem. However I continue to get the error message described above.

Can anyone offer any advice on how I can sort this out?

Cheers

will103


----------



## Darkshadow (Nov 4, 2003)

10.3's bash doesn't use the .bashrc file ...which is a pain.  You can edit the /etc/bashrc file, but you'll need to use sudo or be root to do so.


----------



## naodx (Nov 4, 2003)

Darkshadow,

That isn't entirely true. Yes as installed bash doesn't seem to look for a user's .bashrc file, but you can change that by adding one line to /etc/profile.

Open /etc/profile via your favorite editor (mine is vim) and add the following line:

. ~/.bashrc

note there is a space between the first period and the ~ symbol.

You will probably have to do this using sudo.

sudo vim /etc/profile (or whatever editor you use)

This will allow you to set up a .bashrc file for each individual that has an account on your computer.

Here are a few of the lines I have in my .bashrc

set autolist
set filec
. /sw/bin/init.sh

with the . /sw/bin/init.sh line, I can use fink commands in both the terminal and in x11.

try it, it should work for you.


----------



## Darkshadow (Nov 5, 2003)

Well, yes...I meant as installed.  Though truthfully, I didn't know it _did_ access the .profile file.


----------



## donkey (Nov 8, 2003)

these are all good solutions, but if you don't want to edit global files (those in /etc) you can all all that path and source stuff to ~/.bash_profile.  

or even easier for you if you already have ~/.bashrc would be to create ~/.bash_profile and put source ~/.bashrc in it.

bash for os x automagically reads your .bash_profile when it starts up.


----------



## naodx (Nov 8, 2003)

donkey,

Yep that did the trick as well, I never knew that would work. I followed the instructions off of macosxhints.com which said to edit the /etc/profile file. I would much rather keep any modifications in my home directory than in /etc.

Thanks


----------



## will103 (Nov 13, 2003)

Sorry for delay in replying folks - have been experiencing some computer problems lately. Thanks for the suggestions. Will try them out soon.

will103


----------

