1830367 Members
2159 Online
110001 Solutions
New Discussion

Script in csh

 
SOLVED
Go to solution
Carme Torca
Super Advisor

Script in csh

Hello,

I'm working again with csh scripts, now if have to put one if... I need compare if $VAR1 <= $VAR2, but I don't find some information about it.
It try about some differents like, for example:
--------------------------
set VAR1 = 10
set var2 = 20
if ($VAR1 <= $VAR2)
then
echo $VAR1
else
echo $VAR2
endif
---------------------------
but it doesn't works fine.
Could you help me? o tell me some link with some information about csh scripts???

Thanks a lot of.
Carmen.
Users are not too bad ;-)
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: Script in csh

Hi:

Try this guide as a resource in addition to the man pages ('man csh'):

http://docs.hp.com/hpux/onlinedocs/B2355-90046/B2355-90046.html

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: Script in csh

I hate csh but you need to move 'then' to the
same line as the if (expression) and all is well.
If it ain't broke, I can fix that.
Gregory Fruth
Esteemed Contributor

Re: Script in csh

Furthermore, the "set var2 = ..." should be "set VAR2 = ...".

P.S. csh is a terrible language for writing scripts. If possible,
please consider using the POSIX shell (sh) or Korn shell (ksh)
or almost anything else besides csh.

http://www.perl.com/pub/language/versus/csh.html

(Some of the bugs listed may have been fixed by individual
vendors, and tcsh seems to have fixed many of them.)