We can do this to save the output into variable
x=$(curl -s http://www.example.com)
y=$(curl -s http://www.example.com)
We can do this to make http requests concurrently
curl -s http://www.example.com &
pid1=$!
curl -s http://www.example.com &
pid2=$!
wait $pid1 || echo failed
wait $pid2 || echo failed
But how to combine them?
My requirement is
- Run request concurrently
- Save response into several variables without create a temporary file
- Get exit code of each request
- Using shell script
Is it possible on shell script? It'll be much more easier if I can use python with library like aiohttp... But no