I am facing this error ' syntax error: unexpected end of file' while executing the following script: pre. I tried to run that. I did not get a syntax error. In fact it looks mostly good syntax wise. Please see the output below: $. To the shell, this looks like three assignments that apply to the command fi. If you ever got to execute this line, you' d see an error bash: fi:. if [ - n " $ 1" ] then echo " 111" else echo " 222" fi exit 0 执行sh my. sh par 提示syntax error: unexpected end of file. 错误请问为什么啊? 文本编辑是. Edit: Note that the original post has been edited since this answer was written and has been reformatted.
You should look at the history to see. How to debug Unix and Linux shell script errors ( syntax errors) with the shell' s - x. sh: line 41: syntax error: unexpected end of file. Hello Experts, I am getting error while execute script from Linux system. / BOD: - c: line 7: syntax error: unexpected end of file. hey I am very new to shell scripting and keep getting this error message so any advice would be gladly received! I have simplified my code. sh script, but I got an error. sh: line 34: syntax error: unexpected end of file I haven' t learn syntax of shell script, could you tell me. You missed a fi for inner if : if [ " $ mes" - lt 12 - a " $ mes" - gt 0 ] ; then echo " muy bien, sigamos.
" else if [ " $ mes" - gt 12 - a " $ mes" - lt 0 ] ; then echo.