Register
It is currently Thu Dec 18, 2014 4:41 pm

Bash Calculator - Version2


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Mon Jun 19, 2006 1:03 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
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



Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP