0

Could anyone offer some insight as to why this would give me an unexpected end of file error at line 5? I tried following a guide with making an infinite while loop but I couldn't figure out why mine was any different. Here's all the code:

while :
do
    screen -S pvp java -Xms8G -jar spigots.jar nogui
done

(I also tried with true instead of the :)

If anyone can see why it would throw that error, please tell me :) If you need any more information let me know

  • you must turn on some switch like `set -e` or something else. try to add `set -x` at the top of your script and keep the stderr and see what happened. – Jason Hu Nov 06 '17 at 01:31
  • 1
    Your script is of 4 lines which you showed and error is coming on 5th line, so do you have only this code snippet or any other code is also there, please confirm once. – RavinderSingh13 Nov 06 '17 at 01:40
  • @RavinderSingh13 This is all the code, edited for clarification on that. – reeve blake Nov 06 '17 at 01:43
  • How are you running this script and what's the error message? – melpomene Nov 06 '17 at 01:45
  • @HuStmpHrrr Added set -x to the top, gave 'invalid option 1: set -'. Without the - it didn't give an other than the original on line 6. – reeve blake Nov 06 '17 at 01:47
  • is that even bash? type `help set` in any session. what does it say? – Jason Hu Nov 06 '17 at 01:48
  • @melpomene running it on a linux vps with ./start.sh and the error message is ' line 5: syntax error: unexpected end of file' – reeve blake Nov 06 '17 at 01:48
  • ... and you don't have a `#!` line in your script? – melpomene Nov 06 '17 at 01:49
  • @melpomene No, first time doing this so I have little knowledge of things. – reeve blake Nov 06 '17 at 01:51
  • Loop is correct but the screen command – asio_guy Nov 06 '17 at 03:29
  • 2
    I'm pretty sure @thatotherguy is right that the script has DOS/Windows line endings (see [here](https://stackoverflow.com/questions/31886144/why-is-a-shell-script-giving-syntax-errors-when-the-same-code-works-elsewhere)). That "invalid option" error message where the close quote is at the beginning of the line is a dead giveaway. – Gordon Davisson Nov 06 '17 at 03:33

0 Answers0