cshell floating number arthematic

Status
Not open for further replies.

shiv_emf

Advanced Member level 2
Joined
Aug 31, 2005
Messages
605
Helped
22
Reputation
44
Reaction score
6
Trophy points
1,298
Activity points
4,106
Hi
How to add two floating number in schell script ?

1.2 + 1.3

thanks
 

set result=`echo 3.2 2.1 + p | dc`
echo $result


This will give the result 5.3

Mind the quotes - ( ` ` is not ' ' )
 

    shiv_emf

    Points: 2
    Helpful Answer Positive Rating
thanks!

Do u know awk, sed and zgrep. i was searching for scripts . usage....
 

shiv_emf said:
thanks!

Do u know awk, sed and zgrep. i was searching for scripts . usage....

Still a novice.
Awk and sed one-liners will be really helpful when working with the shell.
For scripting we can stick to either Perl or Tcl.
 

    shiv_emf

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…