Sponsored Content
Full Discussion: Calculator
Top Forums Shell Programming and Scripting Calculator Post 302189327 by in2nix4life on Friday 25th of April 2008 12:31:18 PM
Old 04-25-2008
Since Bash only recognizes normal integers, you can pipe the math through the 'bc' utility and it'll return float values.

RES=$(echo "$IN1" "$OPR" "$IN2" | bc)

Hope this helps.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calculator program..

Hey can anyone tell me the korn script code to implement an interactive integer calculator using the shell's built in arithemetic expression evaluation (2 Replies)
Discussion started by: sahithi_khushi
2 Replies

2. UNIX for Dummies Questions & Answers

calculator

hi, im new to the unix system and scripting and was wondering if anyone could help me with this problem iv been havin... i want the system to: 1. ask me for a number 2. ask me for a command to use on that number (* + - /) 3. ask me for another number 4. then ask me for another command, if the... (2 Replies)
Discussion started by: jdougy
2 Replies

3. Shell Programming and Scripting

Help with calculator code

Hi Guys, I found this code in net.. it is working fine.. But can anybody explain me the sed statement used in the code.. echo "Enter the expression:\c" read express eval echo "$express"|sed 's/^/'$precision' \ /'|bc -l|\ sed -n '1,${ /syntax/!{ } ... (2 Replies)
Discussion started by: mac4rfree
2 Replies

4. Shell Programming and Scripting

Permission bit calculator ???

Hi, Does anyone have a UNIX permission bit calculator script that I can use? Basically, am looking for one where I don't have to a ls -l to check the permission on a file or directory. Am looking for a script that will display the permission bits and then just display what those permission... (1 Reply)
Discussion started by: newbie_01
1 Replies

5. Homework & Coursework Questions

Problem with calculator script

I'm having some trouble implementing a basic calculator using command line options. The script is supposed to take (multiple) arguments -a,-d,-m,-s for addition, multiplication, division, and subtraction. I'm pretty sure I know how to parse through the options with getopt(), but I have no idea... (17 Replies)
Discussion started by: zkapopou
17 Replies

6. Shell Programming and Scripting

chmod calculator script

so just spit ballin here, i was wondering if anybody knew how to make a chmod calculator script. basically go to this website http://mistupid.com/internet/chmod.htm i would like something like this that i can use in a terminal tho. so like i run the scrip and it ask for owner what... (1 Reply)
Discussion started by: hookitup
1 Replies

7. Homework & Coursework Questions

Simple Calculator

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known/data: Script a simple calculator. In the command line enter the script file /home/etc/mycalc or /home/etc/mycalc 1 +... (6 Replies)
Discussion started by: herb bertz
6 Replies

8. Homework & Coursework Questions

Creating a calculator with condition

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a calculator application in your home folder called itncacl that will perform the following applications:... (5 Replies)
Discussion started by: mugiboya
5 Replies
gnome-calculator(1)						   User Commands					       gnome-calculator(1)

NAME
gnome-calculator, gcalctool - perform basic, financial, and scientific calculations SYNOPSIS
gnome-calculator | gcalctool [-a accuracy] [-D] [-E] [-v] [gnome-std-options] DESCRIPTION
Gnome calculator is a desktop calculator. It has been designed to be used with either the mouse or the keyboard. It is visually similar to a lot of hand-held calculators. Calculator has the following modes: Basic Mode Provides standard calculator functions. You can store numbers in 10 different memory registers, and easily retrieve and replace the numbers in the memory registers. Basic Mode is the default mode. You can use all of the Basic Mode functions in each of the other modes. Financial Mode Provides several complex financial functions. Scientific Mode Provides many additional mathematical functions, including trigonometric and logical functions. You can also store your own functions and constants, when you use Scientific Mode. EXTENDED DESCRIPTION
Some of the calculator keys have menu marks, this indicates that there is a menu associated with that key. One of the most important things to remember about gnome-calculator is that calculations are performed from left to right, with no arith- metic precedence. If you need arithmetic precedence, then you should use parentheses. Internal arithmetic is now down with multi-precision floating point numbers. Accuracy can be adjusted from zero to nine numeric places in fixed notation, but numbers can be displayed in engineering and scientific notation as well. There is also an option to show or remove trailing zeroes after the numeric point. The calculator reverts to scientific notation when the number is larger than the display would allow in fixed notation. In the scientific mode, the base of operation can be changed between binary, octal, decimal and hexidecimal. Num- bers are initially displayed in fixed notation to nine numeric places, with trailing zeroes removed, in the decimal base. You can use the Copy and Paste functions in conjunction with the numeric display to store or retrieve characters from the clipboard. You can also remove the last digit entered, completely clear the displayed entry and totally reset the calculator. There are ten memory registers. Numbers can be stored or retrieved in these locations, and arithmetic can be performed upon register con- tents. Context sensitive help is also available. Control-F1 toggles whether a tooltip is displayed for the item which currently has focus. On startup, Calculator uses the following configuration resources stored in a GConf database. Resource: /schemes/apps/gcalctool/accuracy Values: Accuracy value Description: The number of digits displayed after the numeric point. This value must be in the range 0 to 9. Resource: /schemes/apps/gcalctool/base Values: Numeric Base Description: The initial numeric base. Valid values are "BIN" (binary), "OCT" (octal), "DEC" (deci- mal), and "HEX" (hexadecimal). Resource: /schemes/apps/gcalctool/display Values: Display mode Description: The initial display mode. Valid values are "ENG" (engineering), "FIX" (fixed-point), and SCI" (scientific). Resource: /schemes/apps/gcalctool/mode Values: Mode Description: The initial calculator mode. Valid values are "BASIC", "FINANCIAL", and "SCIENTIFIC". Resource: /schemes/apps/gcalctool/showzeroes Values: true, false (true) Description: Whether to show trailing zeroes after the numeric point in the display value. Resource: /schemes/apps/gcalctool/showthousands Values: true, false (false) Description: Whether fixed numbers in the decimal base are displayed with thousands separated. Resource: /schemes/apps/gcalctool/showregisters Values: true, false (true) Description: Whether to display the memory register window when Calculator starts. Resource: /schemes/apps/gcalctool/trigtype Values: Trig. type Description: The initial trigonometric type. Valid values are "DEG" (degrees), "GRAD" (grads), and "RAD" (radians). Any constants or functions that the user defines are also stored in the GConf database. OPTIONS
The following options are supported: -a accuracy Specifies the number of digits displayed after the numeric point. This value must be in the range 0 to 9. -D Enable debug mode. -E Enable debug mode in the multiple-precision arithmetic package. -v Show the version number and usage information. gnome-std-options Standard options available for use with most GNOME applications. See gnome-std-options(5) for more information. EXAMPLES
Example 1: Launching Calculator example% gnome-calculator EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/gcalctool Executable for Calculator. /usr/bin/gnome-calculator Symbolic link to gcalctool. ~/.gcalctoolrc User-specific resources for customizing the appearance and color of Calculator. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-calculator | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
Calculator Manual Latest version of the GNOME Desktop User Guide for your platform. attributes(5), gnome-std-options(5) NOTES
Written by Glynn Foster and Rich Burridge, Sun Microsystems Inc., 2003. Updated by Matt Keenan, Sun Microsystems Inc., 2006. SunOS 5.11 12 Sep 2006 gnome-calculator(1)
All times are GMT -4. The time now is 04:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy