我使用各种bash脚本来简化日常操作。有时我运行它们时忘记获取会话令牌,所以我想我会在脚本的早期添加一些--dry-run
命令。我曾期望输出一个操作:
A client error (DryRunOperation) occurred when calling the DescribeInstances operation: Request would have succeeded, but DryRun flag is set.
。将以0
退出 - 毕竟,它在提供的参数方面是成功的 - 但它以255
退出.
当您看到无权运行命令时的输出以相同的错误代码退出时,问题会变得更糟255
:
A client error (UnauthorizedOperation) occurred when calling the DescribeInstances operation: You are not authorized to perform this operation.
(yuck)检查值"请求将成功"的实际输出的唯一解决方案,还是有更优雅的解决方案? 我完全看不出这背后的逻辑。
谢谢
是的,您需要检查输出。