![]() |
|
|
|
|
|||||||
| 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 |
| what is the right syntax ?? | convenientstore | Shell Programming and Scripting | 7 | 06-04-2007 01:21 AM |
| vim and syntax max os | kezzol | OS X (Apple) | 1 | 04-30-2007 11:22 AM |
| Help with the syntax | chandhar | Shell Programming and Scripting | 2 | 03-26-2007 04:38 AM |
| Help with the syntax | chandhar | Shell Programming and Scripting | 2 | 03-25-2007 10:48 PM |
| What does this syntax mean... | DrAwesomePhD | UNIX for Dummies Questions & Answers | 1 | 07-31-2006 08:54 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dear friends,
I am writing a script usiing c-shell. iwant if -else syntax in c-shell i have taken twovariables and in one variable iam storing sysdate.and comparing with other variable if both are same then iam renaming file as oct_2005. please see below code set mon=`date +%m` set yer=`date +%Y` set dat=`date +%d` set pass=`cal $mon $yer | sed '/^$/d' | tail -1 | awk '{printf $NF}'` echo $pass set vrfir=`expr $pass - 1` echo $vrfir echo $dat echo $pass if test $dat == $vrfir ; then mv schedule $montmp$yer #else #mv schedule $montmp$yer fi regards rajan |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I am not a csh programmer, in fact this will probably turn you away from it as well.
Anyway, the syntax for 'if' in csh is like this: Code:
if ($dat == $vrfir) then echo foo! else echo bar! endif Last edited by blowtorch; 11-02-2005 at 04:16 AM. |
||||
| Google The UNIX and Linux Forums |