如何在 Linux shell 中制作 Hashmap?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5063835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 02:57:07  来源:igfitidea点击:

How can I make a Hashmap in Linux shell?

linuxshell

提问by Yazz.com

Possible Duplicate:
How to define hash tables in bash?

可能的重复:
如何在 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?

我希望在 Linux shell 脚本中创建一个哈希映射,它将字符串键与字符串值相关联。有没有一种简单的方法可以做到这一点?

采纳答案by mxi1

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

我想你应该参考这个问题: 如何在 Bash 中定义哈希表?,这很有用。:-)

回答by Keith

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?

或者你还需要什么?