Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If supported, which version of zsh should I use to take advantage of this feature? How to declare and use it in code?

share|improve this question

migrated from Aug 24 '13 at 12:10

This question came from our site for professional and enthusiast programmers.

up vote 9 down vote accepted

Zsh supports hash tables, a quick google search returns many results, here's one

You must first typeset the variable:

% typeset -A hash

then you can store items in the table:

% hash[brown]="mm..  hash browns"
% hash[table]="clever data structure"

then you recover them as usual with arrays:

% print ${hash[brown]}
share|improve this answer
Just a remark: This kind of variables are called associative arrays in zsh. – mpy Aug 24 '13 at 12:13
So they are in PHP, also; it's the rest of the world that calls them hash tables. – Fanfurlio Aug 26 '13 at 8:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.