yes | uniq
The Unix useless machine.
yes | uniq
The Unix useless machine.
Also best done on GNU where of course they managed to write a needlessly complex version of yes(1) (which is already a useless util).
@alcinnz Yeah, because yes(1) is just for repeating a line over and over as an answer to a program, which I can entirely see misbehaving with large writes being sent to it.
If you need to write a bunch of stuff in a block device or similar just cp /dev/zero /dev/dest (yup, dd is also useless in 99% of cases)
Specially as their buffer is 8192 bytes rather than 4096.
And even with that, just filling a long buffer and calling write(2) on it shouldn’t have ended up being that complex.
@lanodan There's always a kernel between yes & whatever program it's piped to, which should prevent large writes being a problem. And makes minimizing writes ideal.
And looking it yes(1)'s code now, there really isn't any additional complexity than that. And parsing a minimal set of commandline flags everyone else does.
Does seem a little silly to spend time optimizing yes(1) like this, but I don't find it worth griping about.
@lanodan You object to them microoptimizing `yes` by filling an entire buffer with "y\n" (or whatever) before repeatedly outputting it?
@GNUxeava @alcinnz @lanodan Someone would have complained if they hadn't. Maybe the optimized one should be a separate program called `very-yes`?
@clacke @lanodan @GNUxeava @babble_endanger The other thing you have to remember is that in the late 1980's early 1990's when GNU took off, sysadmins loved the consistancy, reliability, performance, & features introduced by GNU. You got a UNIX machine: You installed GNU on it.
This was so common that noone saw any reason to explicitly state the "GNU" in GNU+Linux! RMS complaining is him being a victim of his own success.
Chirp! is a social network. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.
All Chirp! content and data are available under the Creative Commons Attribution 3.0 license.