': not a valid identifier

后端 未结 4 1020
不知归路
不知归路 2020-12-20 11:03

I have removed the two if statements from before and replaced them with a case statement and tried to remove all the error from the code. I am trying to run this code but i

4条回答
  •  清歌不尽
    2020-12-20 11:15

    Addressing the issue in the title, ': not a valid identifier

    This happens when read is passed a variable name that ends with a carriage return symbol.

    When that symbol is printed, it sends the cursor back to the beginning of the line.

    Thus, read foo tries to print:

    foo': not a valid identifier
    

    However, because sends the cursor back, what it actually prints is:

    ': not a valid identifier
    

    To fix this, run dos2unix on your file; run :set fileformat=unix in vim, or otherwise transform it to have UNIX newlines instead of DOS newlines.

提交回复
热议问题