Posted By

brownrl on 05/18/13


Tagged

Bash script Calculator command-line


Versions (?)

Simple Command Line Calculator


 / Published in: Bash
 

URL: http://www.itsgotto.be/cv.php

This is a simple wrapper to bc to perform basic calculator duties. with up to 4 decimal place precision. its just one of those things you might find useful. Then again all the os's out there have a gui calc easily ready too.

  1. #!/bin/bash
  2.  
  3. # save this file to 'c' in your bin dir,
  4. # use 'c 7 + 7' or 'c 5 / 3'
  5.  
  6. bc << EOF
  7. scale=4
  8. $@
  9. quit
  10. EOF

Report this snippet  

You need to login to post a comment.