Progressbars in Bash
In a bash script I needed a progressbar for a "for"-loop.
The best solution was to use pv.
photo_count=`find . -name \*JPG | wc -l` for photo in *.JPG; do do_some_stuff $photo echo -n "." done | pv -pte -i0.1 -s${photo_count} > /dev/null
The count is necessary to get a real progressbar and an ETA.
How does it work: pv is counting the characters (here '.') until size (-s) is reached.
The results looks like:
0:00:03 [==========> ] 30% ETA 0:00:10