ksh 关联数组
我有一个需要使用关联数组的脚本。作为 ksh
的新手,我无法找到 ksh
支持关联数组的任何地方。当我尝试使用常规数组语法并分配时,出现索引不能那么大的错误。 ksh
支持关联数组吗?如果不是,替代解决方案是什么?
我需要执行以下操作:
${array[$name]}=value
稍后在代码中读取一个值,因为
${array[$name]}
每次运行此脚本时,我都会从数组中存储和读取大约 2000 个值。
不幸的是,由于脚本中包含的遗留模块的范围,我无法使用 perl。感谢任何帮助、提示或技术。
I have a script that needs to use associative arrays. Being new to ksh
, I am unable to find anywhere that ksh
supports associative arrays. When I try to use regular array syntax and assign, I get an error that index cannot be that big. Does ksh
support associative arrays? If not, what is the alternative solution?
I need to do the following:
${array[$name]}=value
and later in the code, to read a value for
${array[$name]}
I have about 2000 values to be stored and read from the array every time this script runs.
Unfortunately, I cannot use perl
due to the extent of legacy modules to be included inside the script. Appreciate any help, tips or techniques.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ksh
typeset
命令用于声明关联数组。The ksh
typeset
command is used to declare an associative array.