Skip to content

Instantly share code, notes, and snippets.

@suchoudh
Created April 27, 2024 09:34
Show Gist options
  • Select an option

  • Save suchoudh/bdc83c61e52321e7ed4e09aa254915a6 to your computer and use it in GitHub Desktop.

Select an option

Save suchoudh/bdc83c61e52321e7ed4e09aa254915a6 to your computer and use it in GitHub Desktop.
time left % calculation
echo Predicted is $PREDICTED
COUNTER=0
PREDICTED=$1
PREDICTED="${PREDICTED:=12}"
TEST="$(($PREDICTED*60))"
while true
do
echo test is $TEST
COUNTER=$((COUNTER+1))
PERCENTAGE=$(bc <<<"scale=1;(($TEST-$COUNTER)*100)/$TEST")
echo $COUNTER
echo Percentage $PERCENTAGE time left
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment