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
': not a valid identifierThis 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.