while read -r f
do
count=$(($count+1))
echo "Count is at ${count}"
done < <(ls)
Source: Variable incremented in bash while loop resets to 0 when loop finishes – Stack Overflow
Variable incremented in bash while loop resets to 0 when loop finishes was last modified: August 29th, 2019 by