4 ms·
Yes command – output a string repeatedly until killed
- Someone 3y agoFor comparison, the OpenBSD version: https://github.com/openbsd/src/blob/master/usr.bin/yes/yes.c https://github.com/openbsd/src/blob/master/usr.bin/yes/yes.c That’s a lot simpler, but also slower (see https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes_so_fast https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes..., discussed in https://news.ycombinator.com/item?id=14542938 https://news.ycombinator.com/item?id=14542938)
- dusted 3y agoI'm always impressed by the amount of code in this implementation, I'd like to know more about the scenarios where it was determined that for(;;) puts("y"); was too slow.
- rektide 3y agoA long time ago I wrote a program that would pass through stdin but would also inject newlines every N seconds. Useful for log monitoring as a visual & temporal separator.