我需要在 WSL 中执行以下命令:
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
为了从 powershell 执行它,我尝试运行:
Ubuntu1804 run "sudo curl -L 'https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)' -o /usr/local/bin/docker-compose"
但是会发生错误,因为它找不到值uname -s
and uname -m
uname : The term 'uname' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:107
+ ... ocker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(u ...
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (uname:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
但是当我手动输入值时,以下命令有效uname -s
and uname -m
在该命令中。
Ubuntu1804 run "sudo curl -L 'https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64' -o /usr/local/bin/docker-compose"
谁能帮我找到在使用 powershell 时如何将某些命令的结果合并到另一个命令并在 WSL 中执行它?
另外,我如何合并环境变量的值,例如$USER
在 WSL 命令中并从 powershell 执行?