[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: document that read built-in can't return zero-length string in the m
From: |
alex xmb sw ratchev |
Subject: |
Re: document that read built-in can't return zero-length string in the middle of input |
Date: |
Thu, 11 Jan 2024 17:10:44 +0100 |
On Thu, Jan 11, 2024, 15:29 Chet Ramey <chet.ramey@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 chet@case.edu http://tiswww.cwru.edu/~chet/
>
>
- document that read built-in can't return zero-length string in the middle of input, ilya Basin, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input, Chet Ramey, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input, Greg Wooledge, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input,
alex xmb sw ratchev <=
- Re: document that read built-in can't return zero-length string in the middle of input, Ángel, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input, Robert Elz, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Greg Wooledge, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Robert Elz, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Lawrence Velázquez, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Greg Wooledge, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Chet Ramey, 2024/01/15