我正在尝试运行此命令;
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.to-port,Values=22 --query 'SecurityGroups[?((IpPermissions.IpRanges.CidrIp == "0.0.0.0/0") || (IpPermissions.Ipv6Ranges.CidrIpv6 == "::/0"))].[GroupId]' --profile "prod" --region "us-east-1" | out-file $output -Encoding ASCII -append
它抛出以下错误;未知令牌/:(PowerShell似乎不喜欢“/”)
Bad value for --query SecurityGroups[?((IpPermissions.IpRanges.CidrIp == 0.0.0.0/0) || (IpPermissions.Ipv6Ranges.CidrIpv6 == ::/0))].[GroupId]: Bad jmespath
expression: Unknown token /:
SecurityGroups[?((IpPermissions.IpRanges.CidrIp == 0.0.0.0/0) || (IpPermissions.Ipv6Ranges.CidrIpv6 == ::/0))].[GroupId]
- 如何编写命令并告诉PowerShell斜杠只是斜杠并运行它?*
谢谢大家!
运行并列出具有公共IP地址的所有安全组的代码。
1条答案
按热度按时间rur96b6h1#
尝试使用反斜杠作为转义符: