Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Syntax Error - .sh

    I'm getting a syntax error whenever I bash my Here's the error and the sh paste.

    [root server1]# bash
    : No such file or directoryDIR #this one confuses me too
    ' line 10: syntax error near unexpected token `do
    ' line 10: ` do


    BINDIR=$(dirname "$(readlink -fn "$0")")
    cd "\$BINDIR"
    while true
    screen -S 0 java -Xmx1024M -Xms1024M -jar spigot.jar
    echo "If you want to completely stop the server process now, press Ctrl+C before the time is up!"
    echo "Rebooting in:"
    for i in 5 4 3 2 1
    echo "$i..."
    sleep 1
    echo "Rebooting now!"

  2. #2
    i'm guessing you wrote the code in Windows, then copied it over to linux? there are probably carriage returns in there. see them with this:

    cat -v
    you'd see them as ^M characters.

    you can remove them with:

    you may have to install that util first.

    you can also use sed or perl one-liners to remove them.

    Best bet is to use a Windows prog like notepad++ that allows you to write files "for Linux" (w/o embedding Window carriage returns in them).

  3. #3
    Wow. I'm a moron. Perfect answer. Thank you so much for the help!

  4. $spacer_open
  5. #4
    Quote Originally Posted by Poggy View Post
    Wow. I'm a moron. Perfect answer. Thank you so much for the help!
    definitely NOT a moron! that must happen at least once to every single Windows user who is coding for a Linux box.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts