#!/bin/bash
i=1
while read x
do
i=$((i+1))
echo $i
done < <(find . -type f)
echo $i
https://stackoverflow.com/questions/7390497/bash-propagate-value-of-variable-to-outside-of-the-loop
#!/bin/bash
i=1
while read x
do
i=$((i+1))
echo $i
done < <(find . -type f)
echo $i
https://stackoverflow.com/questions/7390497/bash-propagate-value-of-variable-to-outside-of-the-loop