小编fid*_*ity的帖子

将命令的输出返回到关联数组中

我需要将命令的输出放入关联数组中。

例如:

dig mx +short google.com
Run Code Online (Sandbox Code Playgroud)

将返回:

20 alt1.aspmx.l.google.com.
40 alt3.aspmx.l.google.com.
50 alt4.aspmx.l.google.com.
10 aspmx.l.google.com.
30 alt2.aspmx.l.google.com.
Run Code Online (Sandbox Code Playgroud)

如何使用优先级 (10,20,...) 作为键和记录 (aspmx.l.google.com.) 作为值创建关联数组?

bash shell-script associative-array

7
推荐指数
1
解决办法
3927
查看次数

标签 统计

associative-array ×1

bash ×1

shell-script ×1