I have a code that contain this line:

set file = ""    #empty 

what does it mean?

  • This is a csh or tcsh shell script, right? Not bash. – Kusalananda Dec 3 '18 at 14:54
  • yes, it is csh , sorry about that – fatima Dec 3 '18 at 15:03
  • It's an invalid line of code. – roaima Dec 3 '18 at 15:26

The line comes from a csh shell script. It sets the variable file to an empty string. The #empty at the end of the line is a comment. However, the csh shell does not like comments in this context and will complain with

set: Variable name must begin with a letter.

To correct this, move the comment to the line before the assignment:

# set 'file' to an empty string
set file=""
  • 2
    It's because you can set colour="red" shape="square" and so a comment is not permitted in this context. – roaima Dec 3 '18 at 15:28
  • @Christopher what do you mean – fatima Dec 3 '18 at 16:00
  • @kusalananda so I have this part of the code like this can you explain the rest please. set files = "" set k = 100 while($k < 210) set files = "$files test$k.ppm" #keep renaming the files #echo "files= $files test$k.ppm" @ k = $k + 10 end – fatima Dec 3 '18 at 16:01
  • 1
  • @Kusalananda so why would we set an empty string file in a code? – fatima Dec 10 '18 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.