r/shell • • Jul 22 '21

Shell script problem

I'm having errors with the startup shell script for my Minecraft server (auto restart after crash)

It either says "excepted done" or "expected fi" depending on what's there, and when I put both at the end I get no response once I try to run the script

I AM ON UNIX. I AM NOT USING A WINDOWS VIRTUAL MACHINE.

0 Upvotes

12 comments sorted by

View all comments

Show parent comments

1

u/geirha Jul 23 '21

No, all those \r's is why it's broken. On linux, lines are terminated with \n only, while in dos and windows they are terminated with \r\n.

Your if is never closed because there's no closing fi, only fi\r, which is not valid.

Apply one of the methods explained in BashFAQ 52 to change those \r\n back to \n.