cat list.txt | grep '^http://.*\.osm\..*$' | while read line; do
fn=$(basename $line)
do_something()
done
# TODO: check if it did something
In case the grep command returns nothing, it won't enter the loop and do_something() won't be executed.
I can't check what's in $fn outside of the while loop, see Bash variable scope.
What's the least invasive solution for checking if do_something() was executed here?