Hello Gurus,

I'm trying to write a bash script that will let me put in hours and minutes and convert that into a decimal.
Example: 3:35 into 3.58

I am using M for the minutes.

The problem I am having is when I try to divide the result of M *60 by 3600.
I get 0 instead of 0.58

Could someone give me a clue on what I am doing wrong?

UPDATE

I found that I can get the decimal with:

Code:
ec

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

Code:
1.0E-05*5.0E-03
expected ans is
Code:
5.0E-08
2

Code:
1.0E-05/5.0E-03
expected ans is
Code:
2.0E-03
How can I do that?

I'm writing a script and I would like to pass the results from bc into a variable. I've declared 2 variables (var1 and var2) and have given them values. In my script I want to pass the results from bc into another variable say var3 so that I can work with var3 for other calculations.

I am creating (with help) my own version of a calculator script that simply merges 2 arrays ( ${a[0]}${b[0]}${a[1]}${b[1]}...

I want to accumulate the line size of a number of files contained in a folder. I have written the following script:

let a=0
let num=0
for i in folder/*
do
num=`cat $i | wc -l`
a=$a+$num
done
echo $a

What i am geting at the end of the script is 123+234+432+... and not the result of the arithmetic operation of addition.

Hi,

I am trying to execute a script (for once) during the booting time in Ubuntu system.

Hi,

On a hosted linux environment which I have very little control over, I have a PHP script that takes in X number of floats, performs Y number of simple recursive arithmetic calculations, and produces some output for display to the user.

When I first created the script, 'X' and 'Y' were both in the single digits, and execution time wasn't really important because I was in the micro-second rang

Googling around a bit, I found you need to divide by 1.

Hi,

I've been working on a few scripts and have been getting great info.
How, would I include in the below script, how I would let a user know that if they divide a SECOND number by zero, that they would get a divide by zero error? What's the easiest way of working this?

Cordially,
joe.

I think I asked this and didn't get a viable answer before. 'Trying again.