[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: |
Chet Ramey |
Subject: |
Re: document that read built-in can't return zero-length string in the middle of input |
Date: |
Thu, 11 Jan 2024 09:29:03 -0500 |
User-agent: |
Mozilla Thunderbird |
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 chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
- 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 <=
- 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, 2024/01/11
- 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