Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug with associative arrays(?)
- X-seq: zsh-workers 5165
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Bug with associative arrays(?)
- Date: Tue, 2 Feb 1999 01:30:46 -0800
- In-reply-to: <199902020804.JAA08469@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199902020804.JAA08469@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Feb 2, 9:04am, Sven Wischnowsky wrote:
} Subject: Bug with associative arrays(?)
}
} Try this:
}
} % foo=(a b)
} % echo $foo
} a b
} % foo=bar
} % echo $foo
} bar
} % typeset -A foo
} % foo[a]=1
} % foo[b]=2
} % echo $foo
} 1 2
} % foo=bar
} % echo $foo
} 1 2 # Oops?
} % echo ${(kv)foo}
} a 1 b 2 # Yes, really.
}
} ...or is this the intended behavior? If so, why?
I can't get this to happen to me. (Cute cut'n'paste trick follows.)
zagzig[66] Src/zsh -f
zagzig% x=' % foo=(a b)
quote> % echo $foo
quote> a b
quote> % foo=bar
quote> % echo $foo
quote> bar
quote> % typeset -A foo
quote> % foo[a]=1
quote> % foo[b]=2
quote> % echo $foo
quote> 1 2
quote> % foo=bar
quote> % echo $foo
quote> 1 2 # Oops?
quote> % echo ${(kv)foo}
quote> a 1 b 2 # Yes, really.
quote> '
zagzig% x=("${(@f)x}")
zagzig% print -l ${${(M)x:#??%*}##*%}
foo=(a b)
echo $foo
foo=bar
echo $foo
typeset -A foo
foo[a]=1
foo[b]=2
echo $foo
foo=bar
echo $foo
echo ${(kv)foo}
zagzig% eval "$( !! )"
a b
bar
1 2
bar
bar
zagzig%
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author