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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With