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.
Example:
$ printf 'a\0c' | { LC_ALL=C; read -r -N1 a; read -r -N1 b; read -r -N1 c;
echo "a=$a"; echo "b=$b"; echo "c=$c"; }
Expected:
a=a
b=
c=c
Actual:
a=a
b=c
c=
That's questionable, but fine with me. Yet I couldn't find this in the man
page. Can we document it?