Re: export PATH (newbie question)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 22:51 10/18/2003, you wrote:
Hello all-

I have googled, searched the archive, and read my RH Linux books, and I must be missing something here.

What you want here is "man bash", just so you know.


I have a program that I want to run from the command line on a fairly frequent basis, and do not want to have to specify the path every time (as it is several directories down), so after having done the above research, I see that I can type:

export PATH=$PATH:/directory/subdirectory

which adds the necessary directory to my path variable. Works fine, and I can run my little program to my heart's content, just by typing it's name. Fine...

That is, until I reboot, at which point my PATH variable goes back to whatever it was set up to by Red Hat, and I have to type the above command in again (or just navigate to the program I am trying to start). What a pain! I am guessing that there is a file somewhere (in /etc?) that stores a PERSISTANT copy of the PATH variable, and that this is where I need to make my changes. Can anyone point me in the right direction? If it makes a difference, I am using Fedora Core test 3, with all Rawhide updates.

There are two places in which to change your path:


1. In /etc, as you guessed, there is a bashrc file. This file gets read for _all_ bash logins so whatever is in it will take effect for all users who use bash the next time they log in. Note the name of the file is "/etc/bashrc" with no dots in it. You can modify your path here and it will work for all users.

2. In your home directory, there is a ".bashrc" file (note it starts with a dot). This file gets read when you log in, after the /etc/bashrc file so that user-specific configurations can override general ones. You can also modify your path here, but it will only take effect for you.

However, changing the path is not the only way to solve this. Another is to use the alias command and put into your .bashrc or into /etc/bashrc the following line:

alias prog='/usr/local/bin/path/to/some/place/prog'

Now, when you type "prog 33" the bash shell will immediately replace prog with that long path and the program should run correctly. That way you don't modify the path at all. :-)

Does that make sense?


-- Rodolfo J. Paiz rpaiz@xxxxxxxxxxxxxx


-- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux