Created
April 27, 2024 09:34
-
-
Save suchoudh/bdc83c61e52321e7ed4e09aa254915a6 to your computer and use it in GitHub Desktop.
time left % calculation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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