Created
July 26, 2013 13:42
-
-
Save badsyntax/6088936 to your computer and use it in GitHub Desktop.
A basic example showing the concept of callback functions in bash.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
migrate_module() { | |
echo -e "\nRunning migration for module $1" | |
protected/yiic migrate --migrationPath=application.modules.$1.migrations | |
} | |
loop_modules() { | |
for file in `ls $MODULE_PATH`; do | |
if [ -d "$MODULE_PATH/$file" ] && [[ $file =~ ^$MODULE_REGEX ]]; then | |
$1 "$file" | |
fi | |
done | |
} | |
loop_modules migrate_module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment