2016-01-18 11:25:49 -0500, Greg Wooledge:
[...]
> Other shells must go out of their way to suppress it, then.
> 
> wooledg@wooledg:~$ while IFS= read -r -d '' foo; do echo "<$foo>"; done < 
> <(printf 'one\0two\0')
> <one>
> <two>
> wooledg@wooledg:~$ ksh
> $ while IFS= read -r -d '' foo; do echo "<$foo>"; done < <(printf 
> 'one\0two\0')
> $ while IFS= read -r -d x foo; do echo "<$foo>"; done < <(printf 'onextwox')  
>  
> <one>
> <two>
[...]

zsh behaves like bash here (wrt to '', not in corner cases like:
$ echo 'aéb' | bash -c "read -d $'\xc3' a; echo \$a"
a
$ echo 'aéb' | zsh -c "read -d $'\xc3' a; echo \$a"
aéb
)

Note that zsh supports passing NUL characters to its builtins, so

read -d $'\0' var

does do what it says on the tin there.

ksh93's one seems to be broken with multi-byte characters:

~$ echo 'aéb' | ksh -c 'read -d é a; echo $a'
aéb
~$ echo 'aéb' | ksh -c "read -d $'\xc3' a; echo \$a"
zsh: done                echo 'aéb' |
zsh: segmentation fault  ksh -c "read -d $'\xc3' a; echo $a"

-- 
Stephane


Reply via email to