Progress bar in bash

a=0;
for i in `cat $FOLDERLIST`
do
((a++))
percentage=`awk -v a=$a -v b=$NUMBEROFFOLDERS 'BEGIN {printf "%3.0f", a / b * 100; exit } '`

arrow=`printf '=%.0s' $(seq 1 $percentage)`
headed=`printf '%s%s' $arrow '>'`
paddedarrow=`printf '%-102s' $headed`
echo -ne "$paddedarrow  $a/$NUMBEROFFOLDERS [$percentage] \r "
done
echo

njoy  😉

Leave a Reply

Your email address will not be published. Required fields are marked *