Skip to content

Commit

Permalink
Added for_all_dirs function to loop through all subdirectories of the…
Browse files Browse the repository at this point in the history
… current directory and run a command there.

Example: $ for_all_dirs svn up
This will update each subdirectory's content from Subversion. Useful in case you have multiple separate Subversion projects from different roots in the directory that you want to update using one command.
  • Loading branch information
nwinkler committed May 29, 2012
1 parent 84fac4f commit e2c9c06
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/available/base.plugin.bash
Expand Up @@ -183,3 +183,18 @@ buf ()
local filetime=$(date +%Y%m%d_%H%M%S)
cp ${filename} ${filename}_${filetime}
}

for_all_dirs ()
{
about 'loops through all subdirectories of the current directory and executes the specified command in each of them'
param 'command'
group 'base'
example '$ for_all_dirs svn up'
for dir in */
do
echo "Processing $dir"
cd "$dir"
$*
cd ..
done
}

0 comments on commit e2c9c06

Please sign in to comment.