echo foo sleep echo bar sleep echo baz sleep perl -ne chop print print

1
(echo foo; sleep 2; echo bar; sleep 2; echo baz; sleep 2) | perl -ne 'chop; print "\e]0;$_\a"; print "$_\n";'