Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

divide in bash to 1 decimal place

Status
Not open for further replies.

w5000

Technical User
Nov 24, 2010
223
PL

hello,
on a system having no bc, perl, awk, and to which I have no administrator rights (only common user account), with restricted shell (bash), sed and expr available, I need to be able divide numbers to 1 decimal place:

> echo $((10/10))
1
> echo $((5/10))
0

I'd like to get 1.0, 0.1, etc (so leading zero for <1)

also builtin let gives 0
> let "m=1/4";echo $m
0

thanks in advance for a hint!
 
sorry, please ignore this thread in AIX, wrong group.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top