linux - Use output of a command to feed another one -


i have command outputs list of ip addresses; example:

bash test3.sh 

output is:

10.4.128.2 10.4.128.3 10.4.128.4 10.4.128.5 

i want run command using these outputs arguments, 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 this?

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 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -