Skip to content

Instantly share code, notes, and snippets.

@joaocarmo
Created November 19, 2018 11:45
Show Gist options
  • Save joaocarmo/08f1288609b7533ea89cde2a8be12546 to your computer and use it in GitHub Desktop.
Save joaocarmo/08f1288609b7533ea89cde2a8be12546 to your computer and use it in GitHub Desktop.
How to use math in the terminal
# 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