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

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

问题描述

我正在尝试使用bash中的AWS CLI和 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 (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)脚本顶部的AWS_PAGER =" .

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

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

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