Invalid option when running bash script on Debian 7

When I ran

root@Nano:/etc/init.d# ./utserver

      

which is this script http://pastebin.com/c7gxFdci it gives me this output

": invalid option" 

      

no matter how the arguments are executed.

+3


source to share


1 answer


Your file has DOS line endings \r\n

. Here's the relevant section from the bash wiki tag :



  • Make sure your script or data has DOS style trailing characters

    • Use cat -v yourfile

      or echo "$yourvariable" | cat -v

      .

      DOS carriage returns will appear as ^M

      after each line.

      If you find them, remove them using dos2unix

      (aka fromdos

      ) ortr -d '\r'

+7


source







All Articles