Created
June 28, 2015 19:11
-
-
Save thefotes/d7313ff9dad7964da61d to your computer and use it in GitHub Desktop.
Given a path to an Xcode project, loops through all files and checks to see if any files have been imported more than once in the same file.
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
#!/bin/bash | |
set -e | |
read -e -p "Enter path to Xcode project: " FILES | |
eval FILES=$FILES | |
find "$FILES" -type f \( -name "*.h" -or -name "*.m" \) | while read -r f; | |
do | |
MYVAR=$(sed -n '/^#import/p' "$f" | uniq -c | sed -n '/[2-9] #import/p' | sort -nr) | |
if [ -n "$MYVAR" ]; then | |
echo "$f" | |
echo "$MYVAR" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment