Bash help - floating point to integer?

I'm trying to come up with another metric to measure a network devices performance but I pretty much such when it comes to bash.

I'm using curl and outputting %time_total%, which gives me a value like 0.133267s
I used sed 's/.$//' to get rid of the s at the end.

I want to multiply that by 1000 and get rid of the decimal to get me to miliseconds but I'm stumped how. I keep coming up with you can't use floating point math in a bash script..

Ask an expert

1 Like

You know, I always forget about chatgpt. But it's answer doesn't work. The last variable is spits out equals 0. Same road block I ran into trying another way using bc.

You have to be persistent with it. Tell it that is doesn't work and it'll say something like "There has been a misunderstanding try XYZ instead"

I just gave up and am storing the value as seconds instead of ms. Still works as intended

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.