bug-bash
[Top][All Lists]
Advanced

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

Re: printf "%q" and $'...'


From: Antonio Macchi
Subject: Re: printf "%q" and $'...'
Date: Wed, 25 Nov 2009 16:55:47 +0100
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

The answer is in the part you neglected to read.


NULL can be passed to function only "escaped"

\0
\x00

but $'\x00' is not like "\x00", because the first is expanded "before", and the second is expanded "after"

$ printf $'\x00'

+-+-+-+-+-+-+--+  +--+--+
|p|r|i|n|t|f|\0|  |\0|\0|
+-+-+-+-+-+-+--+  +--+--+


$ printf "\0"

+-+-+-+-+-+-+--+  +--+-+--+
|p|r|i|n|t|f|\0|  |\\|0|\0|
+-+-+-+-+-+-+--+  +--+-+--+


right?
if so, thanks a lot!




reply via email to

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