Passing multiple sets of arguments to a command
Posted
by
Alec
on Super User
See other posts from Super User
or by Alec
Published on 2012-10-25T17:47:08Z
Indexed on
2012/10/25
23:04 UTC
Read the original article
Hit count: 242
instances
contains several whitespace separated strings, as does snapshots
.
I want to run the command below, with each instance-snapshot pair.
ec2-attach-volume --instance $instances --device /dev/sdf $snapshots
For example, if instances
contains A B C
, and snapshots
contains 1 2 3
, I want the command to be called like so:
ec2-attach-volume -C cert.pem -K pk.pem --instance A --device /dev/sdf 1
ec2-attach-volume -C cert.pem -K pk.pem --instance B --device /dev/sdf 2
ec2-attach-volume -C cert.pem -K pk.pem --instance C --device /dev/sdf 3
I can do either one or the other with xargs -n 1
, but how do I do both?
© Super User or respective owner