I updated my older bashcalc script.... made it more useful to myself..... what i use it for day to day.....
May or may not be useful to anyone else......
Code:
#!/bin/bash
#######################################################
# Bash CALCulator
#######################################################
#
#
# FILE: bashcalc2.sh
# VERSION: 1.1
# DATE: 06-19-2006
#
# AUTHOR: Crouse - Please visit bashscripts.org and usalug.org
#
#
########################################################
header ()
{
clear; echo "Bash Calculator - Enter a calculation and hit enter";
echo "---------------------------------------------------";
}
calc ()
{
header
while true
do read -p "" bashcalc;
if [ "$bashcalc" = "quit" ]
then
exit
fi
if [ "$bashcalc" = "clear" ]
then
calc
fi
if [ "$bashcalc" = "help" ]
then
clear
echo "Options include:"
echo " help - This help file"
echo " clear - Clears the screen"
echo " quit - Quits the program"
echo " "
read -p "Hit any key to continue" temp;
calc
fi
echo "scale=4; ${bashcalc}" | bc ;
echo "---------------------";
done
}
# Program run starts here
calc
exit