Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: read string containing null
- X-seq: zsh-users 27255
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>, Zsh-Users List <zsh-users@xxxxxxx>
- Subject: Re: read string containing null
- Date: Thu, 21 Oct 2021 14:08:41 +0100 (BST)
- Archived-at: <https://zsh.org/users/27255>
- Importance: Medium
- In-reply-to: <CAP+y1xC9243rukfuZ9m64PMrZJD4O3eP-cu3s9noqXnFak7=KQ@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAP+y1xC9243rukfuZ9m64PMrZJD4O3eP-cu3s9noqXnFak7=KQ@mail.gmail.com>
> On 21 October 2021 at 13:35 Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> Hello, I just found out:
>
> echo -e - a$'\000'b | IFS='' builtin read -r -d '' xx; echo -n - $xx
> result is "a"
>
> is it possible for builtin read not to stop an null bytes? I found nothing
> in documentation.
> thanks
I think -d '' is telling it to treat NULL bytes as a delimiter. Take that out.
If you're not trying to read a line, don't use read. If you "zmodload zsh/system"
there's a sysread command which is more useful for lower level operations.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author