1. #!/bin/bash
    2. function showMsg(){
    3. echo -e "\033[42;37m$1\033[0m"
    4. }
    5. function getdir(){
    6. root_dir=${1-"/Users/chou/Documents/work/projects/iplat"};
    7. # if [[ -z "$1" ]]; then
    8. # #statements
    9. # root_dir=""
    10. # fi
    11. echo 'root_dir:'$root_dir
    12. for element in `ls $root_dir`
    13. do
    14. dir_or_file=$root_dir"/"$element
    15. if [ -d $dir_or_file ]
    16. then
    17. cd $root_dir"/"$element
    18. showMsg 'git pull '$element
    19. git pull
    20. else
    21. echo $dir_or_file
    22. fi
    23. done
    24. }
    25. # root_dir="/Users/chou/Documents/work/projects/iplat"
    26. getdir $*;
    1. sh batchGitPull.sh
    2. sh batchGitPull.sh /Users/chou/Documents/work/projects/eplat