Created
May 2, 2016 19:26
-
-
Save enriched/73126f89292c9e15c8a281ba3a3777e9 to your computer and use it in GitHub Desktop.
Floating point math in bash without bc (using awk)
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/bash | |
# Uses awk to do the comparison so it can handle floating point numbers | |
awke() | |
{ | |
echo "$1 $3" | awk '{ print ($1 '"$2"' $2) }' | |
} | |
awke '3.124' '*' '6' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment