On Mon, 17 May 2010, Denys Vlasenko wrote:

> On Monday 17 May 2010 22:10, Douglas Mencken wrote:
> > Patches welcome? Here's mine.
> > License: Public domain.
>
> > -           while read -r; do
> > -                   test x"$REPLY" = x"INSERT" && REPLY="$s"
> > -                   printf "%s\n" "$REPLY"
> > +           while read -r reply; do
> > +                   test x"$reply" = x"INSERT" && reply="$s"
> > +                   printf "%s\n" "$reply"
> >             done <"$src" >>"$dst.$$.tmp"
> >
> >             if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
> >
> > (also attached)
> > It's easy, isn't it? ;)
>
> Easy and

arguably?

> wrong. It eats leading and trailing whitespace.

I cannot find anything in the opengroup page you earlier referred to:

        http://www.opengroup.org/onlinepubs/009695399/utilities/read.html

saying explicitely "whitespace must me preserved".  On the contrary,

"The line shall be split into fields as in the shell (see Field
Splitting); the first field shall be assigned to the first variable var,
the second field to the second variable var, and so on."


Cheers,

-- 
Cristian
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to