Advertisement
Guest User

numOfLines

a guest
Apr 16th, 2014
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. #!/bin/bash
  2. #make executeable with "chmod +x"
  3. #then place in /usr/bin/
  4.  
  5. totalLines=0
  6. FILES=*
  7.  
  8. for f in $FILES
  9. do
  10.     if [[ $f == "numOfLines.sh" ]]; then
  11.         continue
  12.     fi
  13.  
  14.     echo "Processing $f..."
  15.     lines=$(cat $f | wc -l)
  16.     totalLines=$(($lines + $totalLines))
  17. done
  18.  
  19. echo
  20. echo "Total num of lines in all files:"
  21. toilet $totalLines
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement