I suppose this can do for you ?
eval $(printf 'ping "%s" & ' host1 host2 host3)
It takes advantage of
printf's ability to "auto-iterate" its arguments while re-using its format string over each argument. The above
printf therefore produces a sequence of
ping <hostname> & strings for each host provided as argument, and feeds such sequence of commands through Command Substitution to the
eval command to have them executed immediately.
eval commands are POSIX standard, as well as Command Substitution.
Enclosing whole such command in a subshell comprising an and-ed
wait like this:
(eval $(printf 'ping "%s" & ' host1 host2 host3) && wait)
provides the ability to interrupt everything at will with a simple Ctrl+C.
Else you can control each
ping command singularly through the shell's usual job control.
If your shell has support also for Process Substitutions, you may also use the following:
. <(printf 'ping "%s" & ' host1 host2 host3)
for a few chars less to type.
The gist is the same as for the
eval, but feeds the sequence of
pings to the
source) command through the Process Substitution.