我试图在
Bash脚本命令中捕获aws ec2 delete-snapshot的输出,但是我无法捕获输出.我已经尝试过result = $(command),result =`command`等,但是当我尝试回显$result时,那里什么都没有.
@H_301_10@这是一些示例输出.
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 client error (InvalidParameterValue) occurred when calling the DeleteSnapshot operation: Value (vid) for parameter snapshotId is invalid. Expected: 'snap-...'. root@host:~# echo $testing root@host:~#
还有其他人遇到过这个问题吗?