I'm trying to use unset array[@] to empty an associative array, but something
goes wrong.
This behaves as expected:
$ declare -A array; array[path/directory]=value
This produces an error:
$ declare -A array; unset array[@]; array[path/directory]=value
bash: path/directory: division by 0 (error to
On Wed, Feb 04, 2015 at 09:12:12AM +0100, isabella parakiss wrote:
> I'm trying to use unset array[@] to empty an associative array, but something
> goes wrong.
What caused you to believe that would work?
> This produces an error:
> $ declare -A array; unset array[@]; array[path/directory]=value
On 2/4/15 8:39 AM, Greg Wooledge wrote:
> On that note, today I learned that you are not allowed to use either *
> or @ as the index of an associative array in bash.
What caused you to believe that would work?
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``
On Wed, Feb 4, 2015 at 2:39 PM, Greg Wooledge wrote:
> On that note, today I learned that you are not allowed to use either *
> or @ as the index of an associative array in bash. I guess I can see why,
> but... that's probably going to break something some day.
:)
of course you can ;-)
decla
On Wed, Feb 04, 2015 at 03:37:07PM +0100, Piotr Grzybowski wrote:
> On Wed, Feb 4, 2015 at 2:39 PM, Greg Wooledge wrote:
>
> > On that note, today I learned that you are not allowed to use either *
> > or @ as the index of an associative array in bash. I guess I can see why,
> > but... that's pr
I think you are right, maybe this one should be considered:
diff --git a/lib/sh/shquote.c b/lib/sh/shquote.c
index fff4f81..de05f27 100644
--- a/lib/sh/shquote.c
+++ b/lib/sh/shquote.c
@@ -293,7 +293,7 @@ sh_contains_shell_metas (string)
case '(': case ')': case '<': case '>':
cas
On 2/1/15 1:52 AM, Jonathan Hankins wrote:
> ​Right. My concern is that a potential exploit could inject a malicious
> value for HISTFILE into the environment. I think (but may be wrong) that
> HISTFILE is the only codepath in a default shell invocation that could
> result in a silent writing to
On Wed, Feb 4, 2015 at 4:12 PM, isabella parakiss wrote:
> This produces an error:
> $ declare -A array; unset array[@]; array[path/directory]=value
> bash: path/directory: division by 0 (error token is "directory")
>
> After unsetting all its elements, the array is not associative anymore?
Logic
On 2/4/15 9:42 AM, Greg Wooledge wrote:
> imadev:~$ unset a; declare -A a; a=(["@"]=foo [!]=bar); declare -p a
> declare -A a='([@]="foo" ["!"]="bar" )'
>
> imadev:~$ unset a; declare -A a='([@]="foo" ["!"]="bar" )'
> bash: [@]="foo": invalid associative array key
>
> If the declare -p output is
On 2/4/15 10:27 AM, Piotr Grzybowski wrote:
> I think you are right, maybe this one should be considered:
>
> diff --git a/lib/sh/shquote.c b/lib/sh/shquote.c
> index fff4f81..de05f27 100644
> --- a/lib/sh/shquote.c
> +++ b/lib/sh/shquote.c
> @@ -293,7 +293,7 @@ sh_contains_shell_metas (string)
>
10 matches
Mail list logo