Created
April 30, 2012 15:38
-
-
Save psynaptic/2559399 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
| count_changes () { | |
| stdin=$(cat /dev/stdin) | |
| lines=$(echo "$stdin" | wc -l) | |
| changes=$(echo "$stdin" | grep "^[+-][^+-]" | wc -l) | |
| removed=$(echo "$stdin" | grep "^-[^-]" | wc -l) | |
| added=$(echo "$stdin" | grep "^+[^+]" | wc -l) | |
| echo total $lines lines. $changes altered: $removed removed, $added added. | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment