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
  3. # save this file to 'c' in your bin dir,
  4. # use 'c 7 + 7' or 'c 5 / 3'
  6. bc << EOF
  7. scale=4
  8. quit
  9. EOF


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.