Created
November 19, 2018 11:45
-
-
Save joaocarmo/08f1288609b7533ea89cde2a8be12546 to your computer and use it in GitHub Desktop.
How to use math in the terminal
This file contains 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
# Just include this function in the .bash_profile (or equivalent) file | |
math() { | |
# Use python to perform mathematics | |
if [ -z $1 ]; then | |
echo "Usage: math [expression]" | |
return 1 | |
fi | |
python -c "print $1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment