From 8f8c4cdd176fda4d93a2d1d4b0ae6321d5706e5f Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Sun, 21 Sep 2014 19:18:56 -0700 Subject: Implement new `read --null` flag The `--null` flag to `read` makes it split incoming lines on NUL instead of newlines. This is intended for processing the output of a command that uses NUL separators (such as `find -print0`). Fixes #1694. --- tests/read.in | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/read.in') diff --git a/tests/read.in b/tests/read.in index f864287f..7cf09112 100644 --- a/tests/read.in +++ b/tests/read.in @@ -1,3 +1,4 @@ +# vim: set filetype=fish: # # Test read builtin and IFS # @@ -35,6 +36,8 @@ echo '' | read -l one two print_vars one two echo 'test' | read -l one two three print_vars one two three +echo 'foo bar baz' | read -l one two three +print_vars one two three echo set -l IFS @@ -91,3 +94,25 @@ echo $foo echo $bar echo 'test' | read -n 1 foo echo $foo + +# read -0 tests + +echo +echo '# read -z tests' +echo -n 'testing' | read -lz foo +echo $foo +echo -n 'test ing' | read -lz foo +echo $foo +echo 'newline' | read -lz foo +echo $foo +echo -n 'test ing' | read -lz foo bar +print_vars foo bar +echo -ne 'test\0ing' | read -lz foo bar +print_vars foo bar +echo -ne 'foo\nbar' | read -lz foo bar +print_vars foo bar +echo -ne 'foo\nbar\0baz\nquux' | while read -lza foo + print_vars foo +end + +true -- cgit v1.2.3