Created
January 4, 2011 22:13
-
-
Save jdp/765541 to your computer and use it in GitHub Desktop.
Very dirty script to count selectors in a CSS file
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/sh | |
cnt=0 | |
depth=0 | |
while read -n 1 char; do | |
case $char in | |
"{") | |
((depth++)) | |
;; | |
"}") | |
((depth--)) | |
if [ "$depth" -eq "0" ]; then | |
((cnt++)) | |
fi | |
;; | |
",") | |
((cnt++)) | |
;; | |
esac | |
done | |
echo $cnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment