Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud ssh and commands with parameters

I'm having issues trying to execute a command over ssh using gcloud. This works perfectly when I execute from my Mac:

gcloud compute ssh instanceName --command="cd /folder; ls"

However, when I try to run that from Ubuntu inside one of the VMs, I get the following error:

ERROR: (gcloud.compute.ssh) unrecognized arguments: /folder; ls

Sounds like it is splitting the command by spaces. I tried different options like using single quotes, use vars, etc., but nothing worked for me.

What is the correct way to do it?

like image 380
dgaviola Avatar asked Dec 02 '25 15:12

dgaviola


1 Answers

I found the issue. If you install from the Debian packages following this instructions:

https://cloud.google.com/sdk/#debubu

it will install an old version of gcloud. After installing using these instructions:

https://cloud.google.com/sdk/#nix

I got the latest version (0.9.83) and was able to execute the command without issues.

like image 106
dgaviola Avatar answered Dec 07 '25 05:12

dgaviola



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!