Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: C-Shell Script



--------------------------------------------------------
tlug note from Jason Molenda <crash@example.com>
--------------------------------------------------------

>From Venkatesh RAGHAVAN <raghavan@example.com>
> 
> E_COORD=`expr \($E-$W\)\*\)\*\($X-1)\)/$COL+$W`
> N_COORD=`expr $N-\(\($N-$S\)\*\($Y-1)/$ROWS\)`
> echo $E_COORD $NCOORD

As Paul noted earlier, these are not parsable expressions.

In any case, it looks like expr assigns a different meaning to
parentheses than that of expression grouping.

I normally advise people to not script in csh, but in your case it works
out in your benefit:  csh can do simple math built-in.  Try this:

@ E_COORD = ($E - $W) * ( ($X - 1) / $COL + $W )

(I'm guessing that this is what you meant to write in the first line there.)

See the csh man page for more information about the @ operator.


Jason
Nihon Cygnus
-----------------------------------------------------------------
a word from the sponsor will appear below
-----------------------------------------------------------------
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.   info@example.com
Tel: 03-3351-5977   Fax: 03-3353-6096


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links