On 2006-05-25, Cai Qian wrote:
> Hi,
>
> echo -e "hello \004world" | cat
>
> will print out
>
> hello world
As it should.
> echo -e "hello \004world" | cat > /dev/null
>
> will print out nothing
Of course: you sent it all to /dev/null.
> It suggests that "cat" has not seen EOF (004) generated by echo.
Try piping it to od or hexdump:
$ echo -e "hello \000world" | hexdump -C
00000000 68 65 6c 6c 6f 20 00 77 6f 72 6c 64 0a |hello .world.|
0000000d
Do you expect cat to stop printing after \004? It won't; it will
print all characters. If it didn't, it would be of no use for
concatenating binary files.
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
_______________________________________________
Bug-bash mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-bash