ping will print more than one line. Since head -n 1 exits after the first line has been printed, and sends SIGPIPE to the writer (xargs will receive SIGPIPE, meaning that it's pointless for it) to continue running sincesay that there's nothingno process left to read whatwhatever it printswrites. It thereforeIn response xargs does what most processes do and kills its subprocesses (ping), prints thea warning, probably sends SIGPIPE to its own parent, and then kills itself. But if you check the actual exit code it is zero
You'll notice, becausehowever, that since you haven't set pipefail in your script the exit code of the full script is zero - the exit code of the sed command.