Created
December 25, 2015 05:48
-
-
Save yangsheng1107/f44ee23deeb55a0ea78d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| function loop() { | |
| ## Do nothing if * doesn't match anything. | |
| ## This is needed for empty directories, otherwise | |
| ## "foo/*" expands to the literal string "foo/*"/ | |
| shopt -s nullglob | |
| ## Make ** recurse into subdirectories | |
| shopt -s globstar | |
| for file in "$@"/** | |
| do | |
| ## If $file is a *.c file | |
| if [[ $file == *.c ]] | |
| then | |
| #echo "$file" | |
| uncrustify -c ~/uncrustify.cfg -l c --replace --no-backup $file | |
| fi | |
| ## If $file is a *.h file | |
| if [[ $file == *.h ]] | |
| then | |
| #echo "$file" | |
| uncrustify -c ~/uncrustify.cfg -l c --replace --no-backup $file | |
| fi | |
| done | |
| } | |
| loop "$PWD" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment