Search code examples
shellcsh

csh script error: Variable name must begin with a letter


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?


Solution

  • 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: