2
set number = $< set n = @ $number % 2 

I am new to csh. I am simply trying to understand basic stuff. I am getting this error: set: Variable name must begin with a letter. How do I fix it?

2
  • The C shell has absolutely nothing to do with the C language! Read the tag info before adding unrelated tags! Commented Feb 15, 2017 at 17:57
  • I think there can't be spaces around the =. Commented Feb 15, 2017 at 17:59

1 Answer 1

6

You are using the @ command incorrectly. In order to evaluate and store the result of an expression:

set number = $< @ n = ($number % 2) 

But Csh is particularly painful to use as a scripting language -- you are better off using bash or Python instead. I strongly recommend reviewing these:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.