I want to
- start ping command
- get only the first line
- after output of the first line terminate ping command and put that first line to a variable
I did :
firstline=$(ping -c 1 <site> > tmpfile | head -1)
but it completes ping command and then writes to tmp file and then take the first line. How can I terminate output stream of ping command after output of its first line?