>  From: Chet Ramey <[EMAIL PROTECTED]>
>  Subject: Re: read command and ascii null as delimiter
>  Sent: 2006-09-08 08:49
>  
>  Nathan Coulter wrote:
>  > Feature request: an option, maybe "-0" to use ascii null as the delimiter 
> for the "read" command.  It would make the following two commands produce the 
> same output:
>  >

[SNIP]
>  
>  read -d $'\0' will do most of what you want, with one limitation.  The
>  read builtin accepts only one eol delimiter, so either you ensure that
>  the input ends with a NUL or you pick up the final portion of the input
>  in $REPLY after read returns status 1 upon encountering EOF.
>  

This doesn't seem be available in my version.  Is it a newer feature?

$bash --version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.

$printf 'hello\0there' | { read -d$'\0'; echo $REPLY ; }
-bash: read: -d: option requires an argument
read: usage: read [-ers] [-u fd] [-t timeout] [-p prompt] [-a array] [-n 
nchars] [-d delim] [name ...]
-bash: REPLY: unbound variable

-- 
Nathan "pooryorick" Coulter




_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to