Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.39 KB | None | 0 0
  1. LINES=$(wc -l < testfile)
  2. COUNTER=0
  3. export COUNTER
  4. filename="$1"
  5. echo "length is $LINES"
  6. while read -r line; do
  7.     name="$line"
  8.     echo "done smth with line $name"
  9.     export COUNTER=$(($COUNTER+1))
  10.     echo $COUNTER/$LINES
  11. done < "$filename"
  12. echo $COUNTER
  13.  
  14. #length is        3
  15. #done smth with line first
  16. #1/ 3
  17. #done smth with line second
  18. #2/ 3
  19. #done smth with line third
  20. #3/ 3
  21. #3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement