DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Simple Floating Point Calculator
// Simple floating point calculator
#!/bin/bash
# CalcFloat function borrowed from crouse @ bashscripts.org
function CalcFloat () {
newNumber=`bc -l 2> /dev/null<< EOF
scale = 2
${1} ${2} ${3}
EOF
`
}
function fcalc () {
CalcFloat $num1 \ $oper $num2
answer=$newNumber
echo $answer
}
num1=$1
oper=$2
num2=$3
fcalc





