This is because head
exits as soon as it transfers three first lines. Subsequently, tee
gets killed with SIGPIPE because the reading end of the "FILE" pipe it is writing to is closed, but not until it manages to output some lines to its stdout.
If you execute just this:
tee >(head -n3 >/dev/null) < /tmp/n
You will see what happens better.
OTOH, tac
reads the whole file as it has to reverse it, as does sed
, probably to be consistent.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…