多字命令的大括号扩展?
Brace expansion on multiword command?
如何对多词命令执行大括号扩展?
如果我尝试:
aws s3 ls s3://mybucket/mykey{1..3}/
这会产生:
aws s3 ls s3://mybucket/mykey1/ s3://mybucket/mykey2/ s3://mybucket/mykey3/
但我要找的是:
aws s3 ls s3://mybucket/mykey1/
aws s3 ls s3://mybucket/mykey2/
aws s3 ls s3://mybucket/mykey3/
您必须将其包装在一个循环中:
for i in {1..3}; do aws s3 ls s3://mybucket/mykey$i/; done
如何对多词命令执行大括号扩展?
如果我尝试:
aws s3 ls s3://mybucket/mykey{1..3}/
这会产生:
aws s3 ls s3://mybucket/mykey1/ s3://mybucket/mykey2/ s3://mybucket/mykey3/
但我要找的是:
aws s3 ls s3://mybucket/mykey1/
aws s3 ls s3://mybucket/mykey2/
aws s3 ls s3://mybucket/mykey3/
您必须将其包装在一个循环中:
for i in {1..3}; do aws s3 ls s3://mybucket/mykey$i/; done