On Mon, Feb 25, 2019 at 4:01 PM L A Walsh <b...@tlinx.org> wrote:
> ntc() {  while IFS='' read -r input; do printf "$input;" ; done ; }
> printf $'\xc2\00\00\00\00'|ntc|hexdump -C
>
> both result in no output.

a) If you actually want the null bytes to be piped, the \0 has to be
interpreted by printf.  Using $'' quoting means that \0 and anything
after is already lost after expansion. i.e.  printf 'x\0y' and printf
$'x\0y' are not the same.
b) `read' will not have an exit status of 0 if it doesn't see the
delimeter so the condition in the while loop will never be satisfied
if you don't use -d ''

Reply via email to