yes produces a stream of "y" chars, or other requested.
If Unixen have a pseudodevice for random numbers, why not useful streams like this too?
yes produces a stream of "y" chars, or other requested.
If Unixen have a pseudodevice for random numbers, why not useful streams like this too?
yes produces a stream of "y" chars, or other requested.
Precisely because of that. See yes(1) (which can repeat strings, not necessarily a single character - followed by newline).
It would be unpractical to have many devices, like /dev/repeatY to repeat Y, /dev/repeatO to repeat O etc.
Indeed, if you just want to get repeated zero bytes, consider /dev/zero (see zero(4))
BTW, on Linux, you could easily write your own kernel module implementing /dev/repeatY. But it is probably not worth the effort.
(so the why is also perhaps an historical reason)
Unixen have a pseudodevice for random numbers
These are probably much more difficult to get than a flow of constant bytes, and much more useful (and requires in practice some hardware support). See random(4) and this question. Read also myths about /dev/urandom