builtin read stops at '\0'

2011-05-18 Thread Rafaël Fourquet
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/l

Re: builtin read stops at '\0'

2011-05-19 Thread Rafaël Fourquet
> > > If you want to handle a stream of NUL-delimited strings in bash, the > best approach is to use read -d '', thus: > > imadev:~$ printf '%s\0' one two three | while read -r -d '' s; do echo > "<$s>"; done > > > > > read -d '' means "stop at NUL, instead of stopping at newline". > Thanks for

Re: builtin read stops at '\0'

2011-05-19 Thread Rafaël Fourquet
> > Here's what I'd do: just use tr to swap the delimiters. > > while read -d '' -r group; do > mapfile -t files <<< "$group" > ... > done < <(tr '\n\0' '\0\n' < "yourfile") > > > I want to pipe each group to xargs -0. > > Not what I'd do. > Thanks! But is there something wrong with xargs? or is