News for hackers. Stuff that matters.
Re:How is GNU `yes` so fast? by kccqzy on Tuesday June 13, 2017 @02:41PM (#14547410)
I had the impression that you thought "yes" pipes the output to shell, and then the shell writes to disk. That's incorrect. " > file" means redirecting to a file, and therefore all write system calls actually write to disk.
Re:How is GNU `yes` so fast? by wolfgang42 on Tuesday June 13, 2017 @03:22PM (#14547781)
That's exactly what I thought. Now, had you asked me how redirection worked I would have said "the redirection operators cause the shell to attach a file to the descriptor," but I'd never actually thought through the implications of that in terms of what syscalls get made, and the output of strace presented a rather visceral demonstration of the implications of this clever bit of design.