![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help for Sed Syntax problem | SanjayLinux | Shell Programming and Scripting | 2 | 10-15-2007 10:52 PM |
| syntax problem grepping? | dsimpg1 | Shell Programming and Scripting | 9 | 07-17-2007 05:48 PM |
| Syntax problem with Unix ftp get command | mheinen | HP-UX | 2 | 02-09-2007 10:01 AM |
| syntax problem | rajan_ka1 | Shell Programming and Scripting | 3 | 03-08-2006 10:04 AM |
| multiple cuts syntax problem | Gerry405 | UNIX for Dummies Questions & Answers | 12 | 10-31-2005 06:23 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
syntax problem
Dear friends,
I am writing shell script in csh . i want to make arthimatic operation in csh. i wrote sysntax like this. set val = 230 set tmp = `0.1 * $val + 300` echo $tmp but it is not working . anyone please give me syntax. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I dont think that csh supports direct math operations. You would have to use expr to do any math. And then expr does not support non integer operations.
Try doing something like this: Code:
set val = 230 echo $val set tmp = `echo 0.1 \* $val + 300|bc` echo $tmp |
|
#3
|
|||
|
|||
|
Use the '@' command in csh.
The '@' command in csh does processing of arithmetic expressions.
See the man page for csh. |
|
#4
|
|||
|
|||
|
Google for ``Csh scripting considered harmful'' for some good reasons why you
should try to avoid scripting in csh. |
|||
| Google The UNIX and Linux Forums |