Sourcing a Directory

ZIYAD A. M. AL-BATLY zamb at saudi.net.sa
Mon Jun 13 03:32:43 UTC 2005


On Sun, 2005-06-12 at 21:45 -0500, Carl Karsten wrote:
> Matthew S-H wrote:
> > How do I "source" a directory?
> > 
> > ie:  How might I have a line in my "~/.bash_profile" that  automatically 
> > runs "source ~/.bash_profile_pieces/*" where the "*"  evaluates to each 
> > file in ~/.bash_profile_pieces/"?  I tried running  it with the star and 
> > it only 'sourced' the first file (alphabetically).
> > 
> 
> Um, here is an off the cuff guess:
> 
> $ find ~/.bash_profile_pieces/* -exec echo source {} \;
> 
> the "echo" will show you the commands it would execute - if it is what you want, 
> take out the echo.
> 
> Carl K
> 
No, that wont work.
Here's a solution:
        export $(cat ~/.bash_profile_pieces/*)

Ziyad.




More information about the ubuntu-users mailing list