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