我正在尝试aws ec2 delete-snapshot
在 Bash 脚本命令中捕获 a 的输出,但我无法获得任何东西来捕获输出。我已经尝试过result=$(command)
,result=`command`
等等,但是当我尝试 echo 时,$result
那里什么也没有。
这是一些示例输出。
root@host:~# aws ec2 delete-snapshot --snapshot-id vid --output json>test
A client error (InvalidParameterValue) occurred when calling the DeleteSnapshot operation: Value (vid) for parameter snapshotId is invalid. Expected: 'snap-...'.
root@host:~# aws ec2 delete-snapshot --snapshot-id vid>test
A client error (InvalidParameterValue) occurred when calling the DeleteSnapshot operation: Value (vid) for parameter snapshotId is invalid. Expected: 'snap-...'.
root@host:~# cat test
root@host:~# testing=$(aws ec2 delete-snapshot --snapshot-id vid)
A …
Run Code Online (Sandbox Code Playgroud)