unexpectendoffile

in bash script unexpected “syntax error: unexpected end of file” on if statement [duplicate]

半腔热情 提交于 2019-12-23 09:44:41
问题 This question already has answers here : Bash syntax error: unexpected end of file (17 answers) Closed 3 years ago . W/hen i run the following code snippet #!/bin/bash if [ "foo" = "foo" ]; then echo "true" else echo "false" fi echo "end" i get sfm_write_buffer_test.sh: line 9: syntax error: unexpected end of file this doesn't make any sense. echo statements works fine, but when the if statement is encountered it gives the above mentioned error. 回答1: You're on Cygwin, right? As I said in a

How to properly handle blank, null, or empty lines in C#

こ雲淡風輕ζ 提交于 2019-12-11 01:37:19
问题 I have some C# code that is working with a text file, and i can not seem to get it to work properly with blank or null (whitespace) lines. My code: while (!file.EndOfStream) { line = file.ReadLine(); bool isComment = (line[0] == '/') && (line[1] == '/'); bool isPoint = (line[0] == '(') && (line[line.Length - 1] == ')'); bool isWhiteSpace = string.IsNullOrEmpty(line); Debug.Log("Comment: " + isComment + ", Point: " + isPoint + ", WhiteSpace: " + isWhiteSpace + "Value: '" + line + "'"); if (