Last active
August 29, 2015 14:07
-
-
Save Yank-225/775efdfd33c28df0f4e9 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 | |
| #traversal rules in .gitignore file | |
| while read LINE | |
| do | |
| #ignore empty line | |
| if [ -n "$LINE" ];then | |
| #line include "#" is comment | |
| if [[ $LINE != *"#"* ]] | |
| then | |
| # wildcard * need to find | |
| if [[ $LINE == *"*"* ]] | |
| then | |
| files=($(find -name $LINE )) | |
| #file lists | |
| for file in "${files[@]}"; do | |
| cmd="dropbox exclude add $file" | |
| eval "$cmd" | |
| done | |
| else | |
| #specified file can't use command find | |
| #there may be file with samename | |
| cmd="dropbox exclude add $LINE" | |
| eval "$cmd" | |
| fi | |
| fi | |
| fi | |
| done < .gitignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment