Sourcing a Directory

Matthew S-H mathbymath at
Mon Jun 13 04:29:58 UTC 2005

On Jun 12, 2005, at 11:32 PM, ZIYAD A. M. AL-BATLY wrote:
> 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.

Neither of them worked.  I knew the first one ("find  
~/.bash_profile_pieces...") wouldn't work because that was what I had  
already been trying.

The second idea didn't work either.  It gave a list of "-bash:  
export:  '[blah]': not a valid identifier".

Any other ideas?

More information about the ubuntu-users mailing list