Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-18-2003, 01:27 PM
|
#1
|
Member
Registered: Aug 2003
Location: N.C.
Distribution: rh9, fc1, slack 9.1, 10
Posts: 229
Rep:
|
appending PATH to automatically include subdirectories
when using the UNIX machines at school it seems as though the PATH environment variable automatically updates to include subdirectories from /home/user...when using rh9 on my laptop and the bash shell altering PATH in .bash_profile adds only the specific path and if i create a subdirectory from this directory executables are not recognized. is there a way to use wildcards such as PATH=$PATH:/home/user/newdirectory/* (i have tried this and know it not to work, but you get what i'm trying here...)
any help would be greatly appreciated. thanks
|
|
|
08-20-2003, 09:41 AM
|
#2
|
Member
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111
Rep:
|
No, you can't put wildcards in your PATH. A common practice is to create a directory named $HOME/bin (where $HOME is your home directory) and put your own programs in there. The HOME environment variable is set up for you automatically by bash when you log in. It's also a common practice to let programs in your current directory be run, by putting "." in your PATH.
In your .bash_profile, therefore, you would put a line such as:
PATH=$PATH:$HOME/bin:.
to add your private "bin" directory and your current directory to the end of your PATH. Note that the order of directories in PATH is important, so if you want your own programs to be used in the unlikely case that they have the same name as a system program, put your directories first.
Finally, if you have programs scattered around many sub-directories, and you don't want to move them to your "bin" directory (perhaps you update and recompile them frequently), then the thing to do is create a symbolic link from your "bin" directory to the program using "ln -s". For example, if you have a program at the pathname ~/projects/src/driller/drill, the command:
ln -s ~/projects/src/driller/drill ~/bin
will create a link to that program in your "bin" directory, and it will thus be found when the shell searches your PATH.
|
|
|
08-20-2003, 05:59 PM
|
#3
|
Member
Registered: Aug 2003
Location: N.C.
Distribution: rh9, fc1, slack 9.1, 10
Posts: 229
Original Poster
Rep:
|
thanks mack,
adding the "." is exactly what i was looking for, as i am almost always in the executable's directory when i want to execute my programs for debugging etc. making a bunch of symbolic links just doesn't seem to be a good idea if you are continually recompiling so that the link wouldn't match your current build.
again thanks.
|
|
|
All times are GMT -5. The time now is 12:48 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|