syntax error near unexpected token `
/csgo: line 1: syntax error near unexpected token `in
/csgo: line 1: `case "$1" in i am making a script so i can easily stop/start/restart my CS server. i found some on the web and mashed em together to create this: Code:
case "$1" in anyway, this is a bit of an arse and any help/suggestions would be much appreciated! |
I haven't tried to run your script, but that error looks like your case statement is on line 1 of your script - have you tried it with the script interpreter added? Something like:
Code:
#!/bin/sh |
hmm, that gave me a bad interpreter error, i looked in my bin dir and there is no SH file!
|
Hmm, works for me. I copied and pasted it as is, and runs as expected. How are you invoking it? Try adding this:
#!/bin/bash at the beginning, since /bin/sh didn't work. |
:( still same error.
the script isnt in the root DIR, and i will be executing it from ROOT/home/hlds_1 does this matter while trying to find the file? (as i checked bash DOES exist) i go to that dir and use ./csgo start to execute, this returns my error. btw thanks for quick replies :D |
If you copied and pasted from a website you might some windows control codes in there so try writing it out from scratch and make sure file format is unix.
You could also try #! /path/to/bash make sure you put the leading / |
Quote:
because it worked for zaichik... I was thinking that your interpreter or compiler is missing something and doesn't recognize the case... while I don't think that's the case... just try re-installing the compiler/interpreter |
Quote:
Be sure you have opened the script up with a text editor on the server to check for hidden characters. Even if you don't write out the whole thing from scratch, at least rewrite the first line--but do it in-place, on the server, rather than on a Windows box and then uploading. And just so that there is no confusion, put the sha-bang line as the first line: #!/bin/bash No spaces in that. That way, there is no question what the interpreter is (although it looks like bash reporting the errors to me...) |
yay :D works. thx alot :D
|
All times are GMT -5. The time now is 08:48 AM. |