[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $'\x41\x00\x41' truncates after the first "A"
From: |
Paul Jarc |
Subject: |
Re: $'\x41\x00\x41' truncates after the first "A" |
Date: |
Wed, 29 Dec 2004 11:10:43 -0500 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
dagbrown@lart.ca wrote:
> Description:
> $'(string1)\x00(string2)' truncates the string at \x00.
The execve() interface underlying the invocation of all external
commands uses \x00 to indicate the end of a string. There's no way
around it for external commands. bash could handle builtins
differently, but that inconsistency could lead to trouble. Consider:
var=...
out=`/bin/echo "$var"`
test "$var" = "$out"
You would expect this test to always exit 0, but if var could contain
null characters, and if the internal test command could see those,
then the test would fail.
paul