Simple Command Line Calculator


/ Published in: Bash
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.