The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-27-2009
in2nix4life's Avatar
in2nix4life in2nix4life is offline
Registered User
  
 

Join Date: Oct 2007
Location: East Coast
Posts: 58
You could try wrapping the find command in a for loop. Not sure which OS or shell you're using but under Bash on Linux:

Save the starting directory:
export startdir="/dir"

Then loop:
for dir in `find . -name 'config' -type d`;do cd ${dir//.\//};cd ..;do your thing;cd $startdir;done

Breakdown:
${dir//.\//} will remove the leading ./ from the find output
cd.. will back up to the parent directory
cd $startdir will return to starting directory for the next iteration through the loop

Hope this helps point you in the right direction.