bug-bash
[Top][All Lists]
Advanced

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

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


From: pk
Subject: Re: printf "%q" and $'...'
Date: Wed, 25 Nov 2009 15:32:10 +0000

Antonio Macchi wrote:

> but...
> 
> $ printf one$'\x00'two\\n
> 
> +-+-+-+-+-+-+--+
> |p|r|i|n|t|f|\0|
> +-+-+-+-+-+-+--+
> 
> +-+-+-+--+-+-+-+--+--+
> |o|n|e|\0|t|w|o|\n|\0|
> +-+-+-+--+-+-+-+--+--+
> 
> so the output should be "one", and stop here!
> 
> but the real output is
> onetwo
> 
> so, imho, there's something more...
> 
> 
> 
> 
>> imadev:~$ echo $'foo\0bar'
>> foo
> 
> 
> sorry... I'm a little bit confusing... look
> 
> $ echo foo$'\0'bar
> foobar

You still fail to read the other answers. Hint: read them (and I do mean 
it), then find out how each command expands its arguments, what is seen by 
bash, and what is seen by the commands.


reply via email to

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