+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
It is slightly different in that it adds a trailing NUL, but testing its
absence should be a topic for another test.
Paolo