Another bash scripting problem...
ZIYAD A. M. AL-BATLY
zamb at saudi.net.sa
Tue Jun 21 12:34:44 UTC 2005
On Mon, 2005-06-20 at 22:04 -0400, Matthew S-H wrote:
> It is supposed to source all of the files in a directory.
> However, it needs to make sure of a few things. It needs to own
> ~/.profile_sections, and it shouldn't recurse into sub-directories.
find ~/.profile_sections -maxdepth 1 -type f
or if you want sylinks to be sourced as well:
find ~/.profile_sections -maxdepth 1 ! -type d
Above will find all the files in a directory.
Here's your script:
if test -O $dir; then
for file in $(find $dir -maxdepth 1 -type f); do
(Note that if any file you want to source have a space in it's name the
above script wont be able to source it.)
More information about the ubuntu-users