0
In a bash script, I want to make a curl request that the user should not disturb.
trap "cleanup" 1 2 3 13 15
TMP_OUT=$(curl -H "Content-Type: application/json" -X POST -d "$DATA" "${HOST}:${PORT}"'/main/store' 2>/dev/null &)
wait $!
if [ $? -ne 0 ]
then
fatal "Something went wrong connecting to the service."
fi
How do I make this work when the service doesn't work? The wait returns 0
even when the rc from the curl request is 7
and the script continues, which shouldn't happen.
Attempting to background commands inside
$( )
doesn't really work, because it needs to wait for them to finish to capture their output. What are you actually trying to accomplish, and what do you mean by "that the user should not disturb"? – Gordon Davisson – 2018-10-12T17:47:39.287