Skip to content

Instantly share code, notes, and snippets.

@macsmax
macsmax / bash_progress_bar.sh
Created October 6, 2021 16:59
Bash progress bar function
# Function to print a progress barr, pass three arguments: total counter, current counter, start epoch
function progressbar {
TOT_COUNT=${1}
COUNTER=${2}
STARTEPOCH=${3}
CUREPOCH=`date +%s`
# get the percentage
let CUR_PERC=$COUNTER*100/$TOT_COUNT
# get the elapsed seconds
let DELTA_SECONDS=$CUREPOCH-$STARTEPOCH
@macsmax
macsmax / bash_progress_barr.sh
Last active October 6, 2021 17:01
bash progress bar function
#!/bin/bash
# Function to print a progress barr, pass three arguments: total counter, current counter, start epoch
function progressbar {
TOT_COUNT=${1}
COUNTER=${2}
STARTEPOCH=${3}
CUREPOCH=`date +%s`
# get the percentage
let CUR_PERC=$COUNTER*100/$TOT_COUNT

Keybase proof

I hereby claim:

  • I am macsmax on github.
  • I am macsmax (https://keybase.io/macsmax) on keybase.
  • I have a public key ASCyB9V8WGvW5y3NUiRqwRkmdXeL5grwuho36uBNhN7wPQo

To claim this, I am signing this object: