ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
case "$1" in
# The rest of the script goes here
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.
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.
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.
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
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.
This is actually a very promising explanation. Even if it wasn't copied from a webpage, if you typed it up on a Windows box and then uploaded it, the problem likely is the file format. Yes, text is text...but there are difference bewteen *nix and Windows, especially in newlines.
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...)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.