Bernd Eggink wrote:
> GNU bash, version 4.0.35(1)-release (i686-pc-linux-gnu)
>
> The following syntactically wrong declaration causes a segmentation fault:
>
> declare -A x=y
>
> It should issue an error message instead.
It's not actually a syntax error. It should assign an element with k
Hugo Mildenberger wrote:
> Bash Version: 4.0
> Patch Level: 33
> Release Status: release
>
> Description:
> The bash builtin function "caller" outputs wrong line numbers if the
> script was sourced within the current shell.
Thanks for the report. This is only an issue if caller is
GNU bash, version 4.0.35(1)-release (i686-pc-linux-gnu)
The following syntactically wrong declaration causes a segmentation fault:
declare -A x=y
It should issue an error message instead.
Regards,
Bernd
--
Bernd Eggink
http://sudrala.de
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|
+-+-+-+-+-
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, i
Antonio Macchi wrote:
>> $ printf "\x00\n" | cat -A
>> ^@
>
> it works, so why...
>
> $ printf $'\x00' | cat -A
> $
Read carefully ALL the answers you've been given. The short version is that
$'\x00' is interpreted by bash itself, while '\x00\n' is interpreted by
printf only. But DO READ the
On 25 Nov 2009, at 16:27, Antonio Macchi wrote:
>> imadev:~$ echo $'foo\0bar'
>> foo
>
>
> sorry... I'm a little bit confusing... look
>
> $ echo foo$'\0'bar
> foobar
>
I expect $'\0' expands to the C-string ''. Which then gets added to the
argument after 'foo' and before 'bar'.
When you run read -d $'\x00' what you're really doing is setting up
a bunch of C-strings in memory like this:
+-+-+-+-+--+-
|r|e|a|d|\0|
+-+-+-+-+--+-
+-+-+--+-
|-|d|\0|
+-+-+--+-
+--+--+-
|\0|\0|
+--+--+-
WOW!
but...
$ printf one$'\x00'two\\n
+-+-+-+-+-+-+--+
|p|r|i|n|t|f|\0|
Antonio Macchi writes:
>> $ printf "\x00\n" | cat -A
>> ^@
>
> it works, so why...
>
> $ printf $'\x00' | cat -A
> $
>
> ... not?
The answer is in the part you neglected to read.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8
$ printf "\x00\n" | cat -A
^@
it works, so why...
$ printf $'\x00' | cat -A
$
... not?
On Wed, Nov 25, 2009 at 02:35:51PM +0100, Antonio Macchi wrote:
> it sounds strange, beacuse
>
> $ find . -print0 | while read -d $'\x00'; do touch "$REPLY"; done
>
> works fine.
>
>
> but if I try to "output" $'\x00', I can't.
There's a lot going on here, so I'll try to cover it as best I can
On 25 Nov 2009, at 14:58, Antonio Macchi wrote:
> my goal is very very stupid, like this
>
> $ printf "%q" $(
> to get a "ascii form" of a binary file (something like uuencode)
>
>
> but, as you can see, it does not work only for two binary chars
>
> 0x00, and 0x0a
That doesn't sound like a
Antonio Macchi writes:
> but, as you can see, it does not work only for two binary chars
The argument space is not suitable for binary I/O.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something complet
Antonio Macchi writes:
> it sounds strange, beacuse
>
> $ find . -print0 | while read -d $'\x00'; do touch "$REPLY"; done
>
> works fine.
Your "read -d $'\x00'" is exactly equivalent to "read -d ''".
(You should use read -r -d '' to get really unmangled input.)
> but if I try to "output" $'\x00
You can "output" $'\x00' just fine:
$ printf '\0'
Note that -d $'\x00' is the same thing as -d '', for the reason I mentioned
earlier. The argument to the -d option that "read" takes is a C-string.
Understand the difference between *strings* and *streams*. A stream (standard
output of print
(Note blank line in the output -- one newline from the echo command,
and one from the actual content of $myvar.) Using printf -v instead of
x=$(printf) means you don't suffer from the trailing-newline-removal
that command substitution does.
I'm a bit puzzled by the original e-mail, though. I do
> On 25 Nov 2009, at 08:19, Antonio Macchi wrote:
> > Hi, I'm using older bash 3.2.39, so please forgiveme if in your newer bash
> > this issue does not arise.
On Wed, Nov 25, 2009 at 08:25:00AM +0100, Maarten Billemont wrote:
> As for NUL out outputting anything in your result, the cause is C-st
it sounds strange, beacuse
$ find . -print0 | while read -d $'\x00'; do touch "$REPLY"; done
works fine.
but if I try to "output" $'\x00', I can't.
18 matches
Mail list logo