bug-bash
[Top][All Lists]
Advanced

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

Re: document that echo can't be given a NULL


From: Eric Blake
Subject: Re: document that echo can't be given a NULL
Date: Fri, 10 Mar 2006 18:52:21 +0000

> No way to hand echo or /bin/echo a NULL.

You mean NUL, not NULL.  And printf can do it.

> $ set a $'\x00' b
> $ echo $#
> 3
> $ echo A$'\x01'B|wc -c
> 4
> $ echo A$'\x00'B|wc -c
> 3

Here, command substitutions strip all NULs from the command's
output.  POSIX doesn't specify whether this behavior is allowed
or not, but I think it makes more sense for command substitution
to strip NULs than to risk the inconsistency of arguments being
chopped short as they are passed through exec() calls.

-- 
Eric Blake




reply via email to

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