From e2c9c06f9675d4ca62c3cd848b8ebf6b0d80beb3 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Tue, 29 May 2012 14:26:31 +0200 Subject: [PATCH] Added for_all_dirs function to loop through all subdirectories of the 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. --- plugins/available/base.plugin.bash | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index 98d1fb46..da64af4f 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -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 +}