Syntax error: end of file unexpected (expecting “then”)

前端 未结 3 1773
长发绾君心
长发绾君心 2020-12-16 16:00

I am making this code for a minecraft server plugin updater I am a new shell scripter so I don\'t know alot...
when I run this code I get a error:

#!/bin         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-16 16:29

    1. The Unix directory separator is forward slash not backslash.
    2. Does your editor on windows have an option to save files in "Unix" file format? The shell is seeing the word then^M with a carriage return on the end. If you don't have dos2unix then try running this command: sed -i 's/\r$//' filename

提交回复
热议问题