英文:
Using output of an aws cli command as an input for another command
问题
我一直在尝试使用list-backup-plans
的输出作为get-backup-plan --backup-plan-id
的输入。我尝试了这个命令,但似乎不适用于多个备份计划ID。有人能告诉我正确的命令可以用什么吗?
aws backup list-backup-plans --query BackupPlansList[*].BackupPlanId | xargs -I {} aws backup get-backup-plan --backup-plan-id {}
英文:
I have been trying to use output of the list-backup-plans
to use as input for get-backup-plan --backup-plan-id
. I tried this command but it seems inappropriate for multiple backup plan ids. Could someone address me what correct command can be used?
aws backup list-backup-plans --query BackupPlansList[*].BackupPlanId | xargs -I {} aws backup get-backup-plan --backup-plan-id {}
答案1
得分: 1
请确保指定 --output
选项,并将制表符替换为换行符:
aws backup list-backup-plans --query 'BackupPlansList[*].BackupPlanId' --output text | tr "\t" "\n" | xargs -I {} aws backup get-backup-plan --backup-plan-id {}
英文:
Make sure to specify the --output
option, and replace tabs with newlines:
aws backup list-backup-plans --query 'BackupPlansList[*].BackupPlanId' --output text | tr "\t" "\n" | xargs -I {} aws backup get-backup-plan --backup-plan-id {}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论