1

我正在创建一个 shell 脚本,它将在本地创建几个 dynamodb 表等。这是我正在使用的创建表 AWS CLI 命令:

aws dynamodb create-table --cli-input-json file://table-user.json --endpoint-url http://localhost:8000

使用 table-user.json 具有所有用于创建的表相关信息。

此命令的问题是我需要单击键“q”以继续执行下一行,因为它提供了表详细信息作为输出。前任:

{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "id",
                "AttributeType": "S"
            },
            {
                "AttributeName": "externalId",
                "AttributeType": "S"
            },
.
.
.

如何静默运行 create table 命令?

4

2 回答 2

2

设置AWS_PAGER=""

所以你的命令是:

AWS_PAGER="" aws dynamodb create-table --cli-input-json file://table-user.json --endpoint-url http://localhost:8000
于 2021-03-22T23:38:45.333 回答
0

如果您在 cli 文档中没有找到任何解决方案,请查看 unix yes 命令

您可以执行以下操作:

yes q | aws dynamodb create-table --cli-input-json file://table-user.json --endpoint-url http://localhost:8000

此命令将继续输入指定的字符串(在本例中为q),直到程序完成。

于 2020-11-17T09:41:01.603 回答