#!/bin/bash # progress-bar.sh # Author: Dotan Barak (very minor revisions by ABS Guide author). # Used in ABS Guide with permission (thanks!). BAR_WIDTH=50 BAR_CHAR_START="[" BAR_CHAR_END="]" BAR_CHAR_EMPTY="." BAR_CHAR_FULL="=" BRACKET_CHARS=2 LIMIT=100 print_progress_bar() { # Calculate how many characters will be full. let "full_limit = ((($1 - $BRACKET_CHARS) * $2) / $LIMIT)" # Calculate how many characters will be empty. let "empty_limit = ($1 - $BRACKET_CHARS) - ${full_limit}" # Prepare the bar. bar_line="${BAR_CHAR_START}" for ((j=0; j