Created
December 7, 2016 18:21
-
-
Save damc-dev/86e1d72ce2fa11d8378985988b831685 to your computer and use it in GitHub Desktop.
Bash division (and cheating with Python)
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
#!/bin/sh | |
NUM1="62121" | |
NUM2="64000" | |
PERCENT=$(bc -l <<< "scale=4; $NUM1 / $NUM2") | |
echo $(bc -l <<< "scale=2; $PERCENT * 100") | |
PY=$(python -c "print '%.2f' % ((float($NUM1)/float($NUM2))*100)") | |
echo $PY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment