Skip to content

Instantly share code, notes, and snippets.

@wx13
Created July 19, 2010 22:22
Show Gist options
  • Save wx13/482138 to your computer and use it in GitHub Desktop.
Save wx13/482138 to your computer and use it in GitHub Desktop.
simple way to use awk as a calculator
#!/bin/bash
calc_str=$1
echo Example: clac \'5*3\' | \
awk "
BEGIN{
pi = 3.14159265359;
}
{print ${calc_str}}"
@rsvp
Copy link

rsvp commented Sep 14, 2012

see https://gist.github.com/3709847 for more complete script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment