On 1/11/24 2:37 AM, ilya Basin wrote:
Dear. I needed to read 16 bytes from a binary file and tried to replace a hexdump call with read built-in. I expected that with "-N1" if a NUL character is encountered bash would assign an empty string, however there's no indication that a NUL character was there and it simply assigns the next non-NUL character to the variable.
The read builtin skips over NUL characters because you can't store them
as part of the value of a shell variable. That seems obvious.
What would you like to see documented? That NUL characters don't count
towards the number of characters read to satisfy -N? Doesn't that follow
from the above?
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
