I have a loop that will connect to a server via ssh to execute a command. I want to save the output of that command.
o=$(ssh $s "$@")
This works fine. I can then do what I need with the output. However I have a lot of servers to run this against and I'm trying to speed up the process by backgrounding the ssh connection, basically to do all of the requests at once. If I wasn't saving the output I could do something like
ssh $s "$@" &
and this works fine
I haven't been able to get the correct combination to do both.
o=$(ssh $s "$@")&
This doesn't give me any output. Other combinations I've tried appear to try to execute the output. Suggestions?
Thanks!