title: fish shell --- how to simulate or implement a hash table, associative array, or key-value store
body: <p>I am migrating from <code>ksh</code> to <code>fish</code>.  I am finding that I miss the ability to define an associative array, hash table, dictionary, or whatever you wish to call it.  Some cases can be simulated as in</p>
  
  <p><code>
  set dictionary$key $value
  eval echo '$'dictionary$key
  </code></p>
  
  <p>But this approach is heavily limited; for example, <code>$key</code> may contain only letters, numbers, and underscores.</p>
  
  <p>I understand that the <code>fish</code> approach is to find an external command when one is available, but I am a little reluctant to store key-value information in the filesystem, even in <code>/run/user/&lt;uid&gt;</code>, because that limits me to "universal" scope.</p>
  
  <p>How do <code>fish</code> programmers work around the lack of a key-value store?  Is there some simple approach that I am just missing?</p>
  
  <p>Here's an example of the sort of problem I would like to solve: I would like to modify the <code>fish_prompt</code> function so that certain directories print not using <code>prompt_pwd</code> but using special abbreviations.  I could certainly do this with a <code>switch</code> command, but I would much rather have a universal dictionary so I can just look up a directory and see if it has an abbreviation.  Then I could change the abbreviations using <code>set</code> instead of having to edit a function.</p>