Fandom

Wikianswers

Welcome! Enter your question below. Please use words like "Who, What, Where, When, Why, How, etc..." in your question. Nothing to ask? Click here for a random, un-answered question.

How do you perform arithmetic in tcsh?

1,032,064questions on
Wikianswers
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Integer arithmetic in tcsh can be done in expressions taken by "while", "if", "exit" or the assignment command "@". Floating point arithmetic is not built in.

Example (size of integer):

#!/bin/tcsh
set i=0 j=1
while ($j)
  @ i++ j*=2
end
echo $i

Pay attention to the peculiar order of evaluation! If you type

> @ x = 1 - 1 + 1
> @ y = 2 * 1 / 2
> echo $x $y
-1 0

you probably mean:

> @ x = (1 - 1) + 1
> @ y = (2 * 1) / 2
> echo $x $y
1 1

The C shell by Bruce Barnett and General Electric Company

Also on Fandom

Random Wiki