[NEWBIE] Help with Bashscript for Google Cloud VM instance.
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.
yeah add "cd /home/csgoserver" in your script where you need to go into that dir without the quotes then see what that does for you. then if no, then go into trouble shooting mode to find out why it doesn't then came back and let the others try to help you figure it out if you cannot.
(I'll let someone else tell you about code blocks)
Firstly, wrapping [code] tags around your scripts makes the post easier to read. (That's the # icon on the toolbar.)
Quote:
Originally Posted by skye7777
Is there a way for me to cd into "/home/csgoserver" at the beginning so i can get this script to work.
Yes, you can do exactly that - put cd /home/csgoserver at the beginning, and separate it from the following command(s) with either a ";" or with "&&" if you only want the second command to execute when the first command succeeds.
Alternatively, you can specify the --login option - as per the su man page one of the four things this does is "changes to the target user's home directory".
yeah add "cd /home/csgoserver" in your script where you need to go into that dir without the quotes then see what that does for you. then if no, then go into trouble shooting mode to find out why it doesn't then came back and let the others try to help you figure it out if you cannot.
(I'll let someone else tell you about code blocks)
Im sorry about not following rules. Im familiar with normal linux commands, is it possible to type linux commands directly into bash?
Im sorry about not following rules. Im familiar with normal linux commands, is it possible to type linux commands directly into bash?
that is the moto. if you can do it on the command line then you can do it in the script. that is a good thing, because all you need to do is open a terminal work out the commands then add them into your script. then of course still do test runs before production.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.