svn commit: [25968] trunk/busybox/shell

Mike Frysinger vapier at gentoo.org
Wed Apr 8 21:06:56 UTC 2009


On Wednesday 08 April 2009 11:23:47 David N. Lombard wrote:
> On Sun, Apr 05, 2009 at 04:32:19PM -0700, Mike Frysinger wrote:
> > fwiw, POSIX allows implementations to ignore such binary characters when
> > working with variables and such.  bash does it too.
> >
> > for example, if you do:
> > var=$(cat /some/binary/file)
> > echo "$var" > foo
> > the file "foo" will have all NUL chars stripped from it when compared to
> > the original file
>
> echo "$(</some/binary/file)" > foo

the quoting is no different from my example.  var=$(...) is guaranteed to be 
exactly the same as var="$(...)".

> > of course, this doesnt apply to pipes ...
>
> Is this what you meant?
>
>     $ wc -c bar
>     4840 bar
>     $ echo "$(<bar)" > foo ; wc -c foo
>     2694 foo
>     $ echo "$(<bar)" | wc -c
>     2694
>     $

no, i mean:
	cat bar | wc -c
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090408/095b813d/attachment.pgp>


More information about the busybox mailing list