Makuza
Makuza

Reputation: 149

How do I add a variable to itself in Csh

Hi i am trying to set a variable equal to itself plus another variable so if I do: set lvt_count = 0 set lvt = 1 set lvt_count = $lvt_count + $lvt

It should return a value for lvt_count, but I am getting a set:variable name must begin with letter error for some reason. Please help.

Upvotes: 0

Views: 1016

Answers (1)

jhnc
jhnc

Reputation: 16662

In csh , you don't use set to do arithmetic. Instead use @:

set v1 = 1
set v2 = 2
@ v1 = $v1 + $v2
echo $v1

Upvotes: 2

Related Questions