0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【AWS】CLIのページャー(ページ分割)を無効にする方法

0
Posted at

概要

AWS CLIを使ったスクリプトを動かしていたら、以下のようにページ分割(pager)が効いてしまっていました。

// 省略
    }
    ]
 }
}
(END) //何かキーを押さないと進まない

これがあると次のプロンプト(例えばecho)の結果を見るためには、いちいち何かキーを押す必要があり面倒だなと思いました。特定のスクリプトを動かすときだけでも、ページャーをなくすにはどうすればいいのだろう?

AWS_PAGERを使う

ということで調べてみると早速ありました。

ページャ(lessやmore)が自動的に起動しているため、これをexportコマンドAWS_PAGERでなくすことができます。

スクリプトの先頭に以下を入れてあげることで解決!

export AWS_PAGER=""

上記の記事にも記載されている通り、恒久的に無効化したい場合は、~/.aws/configファイルに書けばOKです。

[default]
cli_pager=

(どうやらCLI v2からデフォルトのページャーを使うようになったらしいです)

(参考)

ちなみにawsコマンドによる標準出力を無くしたい場合は、
> /dev/null
をコマンドの後につけてあげれば無くせます。

また、outputディレクトリに保存したい場合は以下のように指定します。

> "output_dir/sample.json"

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?