How can I avoid script hangup when divide by Zero happens. Validating the variable is the only way? or any otherway in Unix. Actually I need to display 0 when it happens.
Just check. This will turn it into 0/1, which always becomes zero.
Quote:
Seems you Edited, while I am replying....
I'm often sneaky like that. Sorry.
Quote:
Actually, I thought scale & bc are for division and thinking to multiply the result with 100. But I am wrong.
I think 'scale' in bc does pretty much what I did in shell -- multiplies an extra bunch, then cheats the decimal point. bc is smart enough to know when it'd end up 1, though, when my shell statement would do silly things like 0.100
Last edited by Corona688; 09-13-2012 at 02:32 PM..
I am trying to do a shell script to monitor if any files went through in the last hour.
There is a script in cron that runs every sec checking to see if a file is there and ftp the file out of this folder.
Now I just want to add a block of code that will check to see no files went in the last... (3 Replies)
I am writting a script in the ksh shell and am trying to find a way to report the total execution time of the script without requiring the user to specify the time function when executing the script.
Does anyone have any examples they have used. I have been setting up two date variables (one at... (1 Reply)
I am begining to learn bourne shell and as a practice I have written a script which when given the purchase price and percentage of discount calculates the savings.
I somehow cannot figure out why my script fails to do arthimatic calculation on real numbers.
Could anyone look at the script... (5 Replies)
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (1 Reply)
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (8 Replies)
Hi all,
Thanks in Advance , i am very new to programming part in script i think using some caluations+ sed command only we can do this process in script.
for exampl:
i have file in that one line is like this
using sed i can replace the date and all but my requirement is
The... (3 Replies)
I have 2 numbers
xmin = 0.369000018
xmax = 0.569000006
and want to calculate
(xmax- xmin) / 5.0
I have tried using $(( )) but is always giving an error (8 Replies)
Dear All,
I read some variables in a file and assigned as name for each of them.
If I do echo I am able to see the values as 1.0E-05,3.4,5.0E-03 etc,
Now I want to do some mathematical operations with them.
Lets say
1
1.0E-05*5.0E-03
expected ans is 5.0E-08
2
1.0E-05/5.0E-03
expected... (9 Replies)
Discussion started by: linuxUser_
9 Replies
LEARN ABOUT OSF1
glare
GLARE(1) General Commands Manual GLARE(1)NAME
glare - perform glare and visual comfort calculations
SYNOPSIS
glare [ glarefile [ picture [ octree ] ] ]
DESCRIPTION
Glare is an interactive script for executing programs used to locate glare sources and compute glare indices and visual comfort probabil-
ity. If no glarefile is given, the program prompts the user for a one. If the file does not exist, glare asks the user some questions
about the scene in question then runs findglare(1) to compute values to store in the file. Glare then presents the user a menu of avail-
able glare index calculations. After choosing a calculation, glare offers to store the result (usually not useful) or plot the information
(but only for multiple glare angles).
If you are creating a new glarefile, it usually works best to start with a displayed image for reference during the interrogation.
AUTHOR
Greg Ward
ACKNOWLEDGEMENT
Work on this program was initiated and sponsored by the LESO group at EPFL in Switzerland.
SEE ALSO dayfact(1), findglare(1), glarendx(1), igraph(1), rpict(1), xglaresrc(1), ximage(1)RADIANCE 5/2/95 GLARE(1)