Created
January 21, 2020 20:14
-
-
Save sepans/147c1261f6d536c904e6de22bd6fe021 to your computer and use it in GitHub Desktop.
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 | |
verbose=`$( $2 = "-v" )` | |
verbose=0; [ "$2" == "-v" ] && verbose=1 | |
echo "counting lines in directory: $1 params? $2, verbose: use -v? $verbose" | |
sum=0 | |
for filename in `find "$1" -type f` | |
do | |
if [ $verbose = 1 ] | |
then | |
echo " lines in $filename" | |
fi | |
lineNums="$(wc -l < $filename)" | |
sum=`expr $sum + $lineNums` | |
if [ $verbose = 1 ] | |
then | |
echo "file has $lineNums lines, current sum $sum" | |
fi | |
done | |
echo "total number of lines: $sum" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment