Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I usually used tac | tac for a stupid way of pausing in a pipeline. Though it doesn’t work in this case. A typical use is if you want to watch the output of something slow-to-run changing but watch doesn’t work for some reason, eg:

  while : ; do
    ( tput reset
      run-slow-command ) | tac | tac
  done


How is that different from | cat?


`cat` will begin output immediately. `tac` buffers the entire input in order to reverse the line order before printing it. Piping through tac ensures EOF is reached, while piping through tac a second time puts the lines back in order


The easy way to do this is with 'tee /dev/tty' in the middle.


I don’t understand why that would work? The goal is to buffer the output of the commands and then send it all at once.


I misunderstood the goal.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: