如何关闭 AWS CLI 返回值的寻呼机? [英] How to turn off the pager for AWS CLI return value?

查看:35
本文介绍了如何关闭 AWS CLI 返回值的寻呼机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试利用 AWS CLI 和 bash 中的 for 循环来迭代清除多个 SQS 消息队列.bash 脚本几乎按预期工作,我遇到的问题是每次 AWS CLI 发送请求时的返回值.当请求成功时,它返回一个空值并在命令行中打开一个交互式寻呼机.然后我必须手动输入 q 退出交互式屏幕并允许 for 循环继续下一次迭代.当尝试清除大量队列时,这会变得非常乏味和耗时.

I am attempting to utilize the AWS CLI along with a for loop in bash to iteratively purge multiple SQS message queues. The bash script works almost as intended, the problem I am having is with the return value each time the AWS CLI sends a request. When the request is successful, it returns an empty value and opens up an interactive pager in the command line. I then have to manually type q to exit the interactive screen and allow the for loop to continue to the next iteration. This becomes very tedious and time consuming when attempting to purge a large number of queues.

有没有办法配置 AWS CLI 以禁用此交互式寻呼机,使其不会为每个返回值弹出?或者将返回值通过管道传输到单独的文件而不是显示的方法?

Is there a way to configure AWS CLI to disable this interactive pager from popping up for every return value? Or a way to pipe the return values into a separate file instead of being displayed?

我尝试过配置不同的返回值类型(文本、yaml、JSON),但没有任何运气.此外,--no-pagination 参数不会改变行为.

I have played around with configuring different return value types (text, yaml, JSON) but haven't had any luck. Also the --no-pagination parameter doesn't change the behavior.

这是我尝试运行的 bash 脚本示例:

Here's an example of the bash script I'm trying to run:

for x in 1 2 3; do 
  aws sqs purge-queue --queue-url https://sqs.<aws-region>.amazonaws.com/<id>/<env>-$x-<queueName>.fifo; 
done

推荐答案

我自己刚刚遇到这个问题,我能够通过调用 aws cli 作为 AWS_PAGER="" aws ....

Just running into this issue myself, I was able to disable the behaviour by invoking the aws cli as AWS_PAGER="" aws ....

或者,您可以在 (bash) 脚本的顶部简单地export AWS_PAGER="".

Alternatively you could simply export AWS_PAGER="" at the top of your (bash) script.

来源:https://github.com/aws/aws-cli/pull/4702#issue-344978525

这篇关于如何关闭 AWS CLI 返回值的寻呼机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆