Operating System - HP-UX
1846753 Members
5229 Online
110256 Solutions
New Discussion

Re: decimal numbers in shell scripts

 
SOLVED
Go to solution
Tony  LeBlanc
Occasional Contributor

decimal numbers in shell scripts

Could someone show me how to use decimal numbers in a shell script. I know bc and awk can do it, but how? examples please

Thanks,
Tony
2 REPLIES 2
Patrick Wallek
Honored Contributor
Solution

Re: decimal numbers in shell scripts

Here is an example of an expression in one of my scripts that does an arithmetic calculation:

used_disk1=`echo "scale=3\n$used_disk + $used_disk1" | bc`


Does this help?
Tony  LeBlanc
Occasional Contributor

Re: decimal numbers in shell scripts

Thanks Patrick, that does exactly what I wanted!