3 ms·
Why would you want buffer in the yes command though? The point is to only provide output if stdout is being read (ie. stdout is available for writing.) That way
by ninkendo 4y ago
Why would you want buffer in the yes command though? The point is to only provide output if stdout is being read (ie. stdout is available for writing.) That way you only provide as many lines of output as is needed.
Isn’t filling a buffer going to be a huge waste of CPU for the common case where the command only needs to provide one or two “yes”es? (Common case as in, its intended use of working around scripts that interactively prompt you to continue, etc…)
- dolmen 4y ago1. Performance of yes is not a concern for that "common case" (well, is that case still common? who writes only interactive program that require yes/no anwers from the terminal?). 2. Filling a buffer has much less CPU (power) cost as it doesn't involve context switching like I/O.