Reputation: 19
I have a command that outputs a list of IP addresses; for example:
bash test3.sh
Output is:
10.4.128.2 10.4.128.3 10.4.128.4 10.4.128.5
I want to run a command using these outputs as arguments, like this:
fio --client 10.4.128.2 jobfile1 --client 10.4.128.3 jobfile1 --client 10.4.128.4 jobfile1 --client 10.4.128.5 jobfile1
How can I do this?
Upvotes: 0
Views: 56
Reputation: 785631
You can use printf
:
out=$(bash test3.sh)
printf "fio"; printf " --client %s jobfile1" $out; echo
fio --client 10.4.128.2 jobfile1 --client 10.4.128.3 jobfile1 --client 10.4.128.4 jobfile1 --client 10.4.128.5 jobfile1
Upvotes: 1