#!/bin/zsh # excludes folders name not match 'xxx_bundle' for file in $(ls -a | sort | grep xxx_bundle) do if [ -d $file ]; then # excludes ./.. path if [ $file = '.' -o $file = '..' ]; then continue fi pushd $file modifies_num=$(git status --short | wc -l) if [ $modifies_num -gt 0 ]; then echo $PWD $modifies_num fi # get into node_modules and check modify if [ -d node_modules ]; then pushd node_modules for node_file in $(ls -a | sort) do if [ -d $node_file -a $node_file != '.' -a $node_file != '..' ]; then pushd $node_file node_modifies_num=$(git status --short | wc -l) if [ $node_modifies_num -gt 0 ]; then echo $PWD $node_modifies_num fi popd fi done popd fi # fi popd fi done
注意 这段脚本是用 zsh 做解释器的,因为 zsh 的功能比较多,语法用的比较爽,不要用 sh 去执行。