# main function designed for quickly copying to another programprogressBar() { Bar=""# Progress Bar / Volume level Len=25# Length of Progress Bar / Volume level Div=4# Divisor into Volume for # of blocks Fill="▒"# Fill up to $Len Arr=( "▉""▎""▌""▊" ) # UTF-8 left blocks: 7/8, 1/4, 1/2, 3/4 FullBlock=$((${1} / Div)) # Number of full blocks PartBlock=$((${1} % Div)) # Size of partial block (array index)while [[ $FullBlock -gt0 ]]; do Bar="$Bar${Arr[0]}"# Add 1 full block into Progress Bar (( FullBlock-- )) # Decrement full blocks counterdone# if remainder zero no partial block, else append character from arrayif [[ $PartBlock -gt0 ]]; then Bar="$Bar${Arr[$PartBlock]}"; fi# Pad Progress Bar with fill characterwhile [[ "${#Bar}"-lt"$Len" ]]; do Bar="$Bar$Fill"; doneechoprogress:"$1 $Bar"exit0# Remove this line when copying into program} # progressBarMain() {tputcivis# Turn off cursorfor ((i=0; i<=100; i++)); do CurrLevel=$(progressBar"$i") # Generate progress bar 0 to 100echo-ne"$CurrLevel"\\r# Reprint overtop same linesleep.04doneecho-e \\n# Advance line to keep last progressecho"$0 Done"tputcnorm# Turn cursor back on} # mainMain"$@"