> It’s unique in its ability to issue seeks and reads of specific lengths, which enables a whole world of shell scripts that have no business being shell scripts. Want to simulate a lseek+execve? Use dd!
How would one simulate a call to execve with dd? Seems like a totally different problem domain.
If not for that explicit `lseek`, `head -1` would have skipped the entire 8k buffer.
As far as I know, this is exclusive to GNU cat. Neither Busybox nor OSX cat will do this, and will therefore throw away an entire buffer instead of just the first line. You can try it out:
Tail employs a large read buffer as well, but it does not matter because you wouldn't use it in the same manner.
Tail is the right tool for the job here. But if you wish to stick with your idiom, read will reliably consume a single line of input, regardless of how it is implemented:
How would one simulate a call to execve with dd? Seems like a totally different problem domain.
reply