Basically in Bash, what I'm trying to do is take a input of seconds from a user and find the hours. So basically if the user enter 35 the output should be 0.00972222.But bash gives me is a zero.heres the command I have:echo Enter the seconds you wish to convert to hours:  && read sec && echo  $((sec/3600)) is the amount of hours Is there a way I can make it so it prints out 0.00972222 if I enter 35.Thanks!
Is it possible to get a decimal output from doing division in Bash?
bash;floating point
Here try this echo $(echo 35/3600 | bc -l )so your command would look likeecho Enter the seconds you wish to convert to hours:  && read sec && echo  $(echo $sec/3600 | bc -l ) is the amount of hours To control the number of significant digits printed, use scale=N. For example:$ echo scale=3; 35/3600 | bc -l .009If you also want to have the leading 0 printed (which, weirdly enough, bc won't do easily), you can feed the number to printf (which can also round it up/down it for you):$ printf '%.3f\n' $(echo 35/3600 | bc -l)0.010$ printf '%.4f\n' $(echo 35/3600 | bc -l)0.0097