[英]Argo CD CLI error when installing on Windows 10 via powershell
我正在尝试按照网站上的命令替换版本,但收到以下错误,在我的 windows 10 PC 上安装 ArgoCD CLI。 它似乎不喜欢 + 运算符? 有人可以帮忙吗?
PS C:\Users\dell.docker> $url = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/argocd-windows-amd64.exe"
At line:1 char:66
+ ... = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 ...
+ ~
You must provide a value expression following the '+' operator.
At line:1 char:67
+ ... ps://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/arg ...
+ ~~~~~~
Unexpected token 'v2.2.3' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
您必须引用版本号:
$url = "https://github.com/argoproj/argo-cd/releases/download/" + 'v2.2.3' + "/argocd-windows-amd64.exe"
当然,您也可以只使用一个带引号的字符串开头,由于使用了可扩展(双引号)字符串( "..."
) ,如果版本号是通过变量提供的,它甚至可以工作:
$version = 'v2.2.3'
$url = "https://github.com/argoproj/argo-cd/releases/download/$version/argocd-windows-amd64.exe"
它似乎不喜欢 + 运算符
问题不是+
运算符,而是使用您打算成为字符串的内容 - v2.2.3
-不带引号。
运算符在 PowerShell(表达式模式)中的表达式上下文中操作,并且在表达式中所有字符串文字都需要引用。
相比之下,只有当您将arguments传递给命令(参数模式)时,您才可以在不引用的情况下传递字符串值(不带空格和其他元字符):
Write-Output v2.2.3 # OK - quoting optional
有关这两种基本解析模式的更多信息,请参阅概念about_Parsing帮助主题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.