Paolo Bonzini wrote: >>> +echo a | grep -P a>/dev/null 2>err || skip_ >> >> Please give skip_ an argument to tell why the test is being skipped. >> >>> +compare err /dev/null || fail_ >> >> Same for fail_ here, and below. > > Done. > >>> +REGEX=a >>> + >>> +echo 'abc >>> +0def >>> +0ghi >>> +0aaa >>> +0gah' | tr 0 \\0> in >> >> You could also do it all one line: >> >> printf 'abc\0def\0ghi\0aaa\0gah\n'> in >> >> either way is ok. > > I wasn't sure of the portability of \0 in printf, but indeed this is nicer: > > printf "%s\n0" abc def ghi aaa gah | tr 0 \\0 > in
Based on it's use in coreutils' test scripts, I'm confident that using printf with \0 is portable enough, so I'd recommend this: printf '%s\n\0' abc def ghi aaa gah > in
