LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to add subdirectories in PATH (https://www.linuxquestions.org/questions/linux-general-1/how-to-add-subdirectories-in-path-222730/)

marconi 08-26-2004 12:33 PM

How to add subdirectories in PATH
 
Hi all!
I am relatively new to Linux, well this will probably be evident from my question. while writing a script I faced a problem of adding all the subdirctories of a certain directory in my path. I only know the way to add one directory at a time.
i.e.
export PATH=$PATH:ltp/kernel

but what I want to do is to add all the subdirectories of directory kernel in my path for successful execution of my program.

Please help me in this regard. Thanks in advance

Regards
MarcONI

ToniT 08-26-2004 01:23 PM

That sounds really strange that you want to put many entries to path.

Anyways, here it goes:
Code:

DIRS=`echo /foo/bar/baz/*`
export PATH=$PATH:${DIRS// /:}

That adds subdirectories of /foo/bar/baz/ to the PATH environment variable.

LinuxLala 08-27-2004 02:15 PM

hi marconi

Please take care of what forum you post your question in. This is the Linux-Certification forum, to discuss about the various certifications. There are many forums here at LQ. please choose the right forum so that your question gets the attention it deserves.

This post has been reported and will soon be moved to an appropriate forum so don't create a new thread.

Regards.

XavierP 08-27-2004 03:27 PM

Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.


All times are GMT -5. The time now is 08:56 PM.