I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at weston@westonganger.com. Thanks in advance for any leads!

Do Math From The Command Line

Posted by Weston Ganger

I always have a terminal open and sometimes I need to add or multiply some values really quick. So I looked into it and made a bash function so I can do this. Add this to your .bashrc

  awk "BEGIN { print "$1"}"

Be sure to reload your bashrc by running ‘exec bash’ or ‘source ~/.bashrc’ or open a new tab And now when you want to do some math right quick.

math 4.2*6.5
math 56+34

### if using parenthesis be sure to wrap it as a string
math "127/(5*3)"

Hope this helps some of you. See the stack exchange link for more methods

Related External Links:

Article Topic:Software Development - Linux

Date:April 09, 2015

Recommended Posts