Skip to main content

One-line calculators

Old news, I know. But still nice to know.

 awk "BEGIN { print $* ; }"

 echo "scale=5; $1" | bc -l

 perl -e "print $1";echo

Prepend any of these lines with #!/bin/bash, call it, well, calc, and invoke your new calculator with 'calc 2+2'.

PS: No, the 'run command' utility of KDE can't compete with these one-liners. But katapult can.

Contents © 2018 Cobra · About · Privacy · Powered by Nikola · Creative Commons License BY-NC-SA