Re: read -d no longer accepts NUL as line delimiter from tty
From:
Chet Ramey
Subject:
Re: read -d no longer accepts NUL as line delimiter from tty
Date:
Thu, 5 Feb 2026 11:01:03 -0500
User-agent:
Mozilla Thunderbird
On 2/5/26 6:15 AM, Martin D Kealey wrote:
When I go
read -d '' VAR
it doesn't accept the line of input when I type the NUL byte (variously ^@,
^`, or ctrl-space depending on the keyboard).
It turns out that's because _POSIX_VDISABLE is '\0' on my system; I
suspect that's typical, though I have seen systems where it's '\xff'.
Thanks for the report. It's 255 on macOS, and presumably most BSD-based
systems, and Solaris, at least. Looks like Linux uses 0.
--
``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/