diff options
author | Kevin Ballard <kevin@sb.org> | 2014-09-21 19:18:56 -0700 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2014-09-21 19:27:26 -0700 |
commit | 8f8c4cdd176fda4d93a2d1d4b0ae6321d5706e5f (patch) | |
tree | 68c2f6d4eb2bbd7a4b975b7901cc0db95f83b740 /tests/read.in | |
parent | f889ad0fda9bf8d1f354cad37d508e0c4205af48 (diff) |
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.
Diffstat (limited to 'tests/read.in')
-rw-r--r-- | tests/read.in | 25 |
1 files changed, 25 insertions, 0 deletions
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 |