bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read command and ascii null as delimiter


From: Nathan Coulter
Subject: Re: read command and ascii null as delimiter
Date: Tue, 12 Sep 2006 00:37:44 -0400
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)

Chet Ramey wrote:
"Nathan Coulter" <org.gnu.bug-bash@pooryorick.com> writes:

 read -d $'\0' will do most of what you want, with one limitation.  The
         ^^^^^^^^

This is actually equivalent to read -d ''.



So, to recap, the way to read null-delimited data is:

printf 'hello\0there' | { while  read -d ''; do echo $REPLY ; done ; echo 
$REPLY ; }

The final reply picks up whatever remains after th last $'\0'.

--
Nathan "pooryorick" Coulter








reply via email to

[Prev in Thread] Current Thread [Next in Thread]