25
8
In Linux, you can use xargs -d,
to quickly run the hostname
command against four different servers with sequential names as follows:
echo -n 1,2,3,4 |xargs -d, -I{} ssh root@www{}.example.com hostname
It looks like the OSX xargs command does not support the delimiter parameter. Can you achieve the same result with a differently formatted echo
, or through some other command-line utility?
1If the values can contain spaces, linefeeds, or tabs, you could use something like
printf 'a\0a' | xargs -0 -n1 echo
. – Lri – 2012-10-18T07:20:01.310