Guest User

Untitled

a guest
Aug 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. variable reset in a bash script
  2. #!/bin/bash
  3.  
  4. N=0
  5.  
  6. ls -l | while read L; do
  7. N=$((N+1))
  8. echo $N
  9. done
  10.  
  11. echo "total $N"
  12.  
  13. 1
  14. 2
  15. 3
  16.  
  17. total 0
  18.  
  19. #!/bin/bash
  20. IFS=
  21. N=0
  22.  
  23. while read L; do
  24. N=$((N+1))
  25. echo $N
  26. done <<<$(ls -l)
  27.  
  28. echo "total $N"
Add Comment
Please, Sign In to add comment