<p>I read book &quot;2021 - Apress - Kubernetes&quot; (page 4)</p>
<p><a href="https://i.stack.imgur.com/FoQzW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FoQzW.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/74Sc1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/74Sc1.png" alt="enter image description here" /></a></p>
<pre><code>(for i in 0 1; ){ do gcloud compute instances create worker-${i} --async --boot-disk-size 200GB --can-ip-forward --image-family ubuntu-2004-lts --image-project ubuntu-os-cloud --machine-type n1-standard-1 --private-network-ip 10.240.0.2${i} --scopes compute-rw,storage-ro,service-management,servicecontrol,logging-write,monitoring --subnet kubernetes;} done
</code></pre>
<p>I catch error</p>
<pre><code>
C:\Program Files (x86)\Google\Cloud SDK&gt;(for i in 0 1; ){ do gcloud compute instances create worker-${i} --async --boot-disk-size 200GB --can-ip-forward --image-family ubuntu-2004-lts --image-project ubuntu-os-cloud --machine-type n1-standard-1 --private-network-ip 10.240.0.2${i} --scopes compute-rw,storage-ro,service-management,servicecontrol,logging-write,monitoring --subnet kubernetes;} done
i was unexpected at this time.

C:\Program Files (x86)\Google\Cloud SDK&gt;
</code></pre>
<p>How to type and run the command success? I want one line command (for easy for copy and paste, not multiple lines command)</p>

Vy Do
<p>It is as others mentioned, the difference between *nix commands and Windows.</p>
<p>Something equivalent to this in PowerShell would be:</p>
<pre><code>foreach ($i in 1,2) {
  gcloud compute instances create worker-$i --async --boot-disk-size 200GB --can-ip-forward --image-family ubuntu-2004-lts --image-project ubuntu-os-cloud --machine-type n1-standard-1 --private-network-ip 10.240.0.2$i --scopes compute-rw,storage-ro,service-management,servicecontrol,logging-write,monitoring --subnet kubernetes
}
</code></pre>
<p>If you want to follow on with the Linux based examples in the book you can make sure you have Docker running on your Windows machine, install WSL 2 (windows subsystem for linux), and finally run a gcloud-sdk docker image based on a linux distribution.</p>
<p>e.g. <code>docker run --rm -it gcr.io/google.com/cloudsdktool/cloud-sdk:slim</code></p>
