1 # Progress library script
3 if [ -z "${__progress_sh_loaded}" ]
5 __progress_sh_loaded=yes
7 # Implement a simple progress indicator
8 # ( i:current i:total i:width -- s:
18 prcnt="$(printf "%u / %u * 100\n" "${cur}" "${all}" | bc -l 2>/dev/null)"
19 elapsed="$(printf "%u - %u\n" "${time}" "${time_start}" | bc -l 2>/dev/null)"
20 remain="$(printf "( %u - %u ) / ( %u / %u )\n" "${all}" "${cur}" "${cur}" "${elapsed}" | bc -l 2>/dev/null)"
24 printf "%0.2f%% E:%us R:%0.1fs" "${prcnt:-0}" "${elapsed:-0}" "${remain:-0}"