I'd like to use standard utilities, rather than compiled code, to efficiently fill a file with a constant value, repeated N times. In the simple version, the value is a single byte; in a complex version - an arbitrary string.
Note:
- If the value is 0, we have
dd if=/dev/zero of=/path/to/file bs=XXX count=YYY
for appropriate values of XXX and YYY. - We can obviously do this with echo
$value >> file
done in a loop, but that should be very slow.