On Thu, Jan 11, 2024, 15:29 Chet Ramey <chet.ra...@case.edu> wrote: > 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. >
additional metadata , that keeps internally track of \0 positions , for like printf or so later .. 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 c...@case.edu http://tiswww.cwru.edu/~chet/ > >