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
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