13

Possible Duplicate:
How to define hash tables in bash?

I wish to create a hash map in a Linux shell script which associates string keys with string values. Is there a simple way I can do this?

Community
  • 1
  • 1
yazz.com
  • 57,320
  • 66
  • 234
  • 385

2 Answers2

6

The environment itself is a hash map that associates string keys with string values.

myvar1=myvalue1
myvar2=myvalue2

etc.

Or do you need something more?

Keith
  • 42,110
  • 11
  • 57
  • 76
  • 3
    Yeha but... Cohesion... I can't just drop colors, animals, numeric, names... into my global variables. It's better to access and modify the variables using a data sctructure... – AFP_555 Oct 30 '17 at 23:04
  • @AFP_555 True, but I wouldn't be using bash if I wanted to go that far. – Keith Oct 30 '17 at 23:37
6

I think you shold refer this question: How to define hash tables in Bash?, which is useful. :-)

Community
  • 1
  • 1
mxi1
  • 166
  • 7