YAML

作者: michael_jia | 来源:发表于2021-12-19 18:25 被阅读0次

YAML

YAML Ain’t Markup Language. YAML is a human friendly data serialization language for all programming languages.

  • 仓库 yq : yq is a portable command-line YAML, JSON, XML, CSV and properties processor.
    wget https://github.com/mikefarah/yq/releases/download/v4.27.5/yq_linux_amd64.tar.gz -O - | tar xz && mv yq_linux_amd64 /usr/bin/yq 直接下载二进制安装到 /usr/bin下,以后使用 yq 即可。
$ yq -V #or --version
yq (https://github.com/mikefarah/yq/) version 4.27.5

示例

  • Processing YAML Content With yq: 对 yq 精髓做了介绍,相当不错。对于和 bash script 的交互也有说明,好文章。
    其中的例子使用到了 bash Associative array,原来是 Associative array in Bash are unordered。
    所以以下语句是没有固定输出顺序的:
for key in "${!content[@]}";
    do printf "key %s, value %s\n" "$key" "${content[$key]}";
done

相关文章

网友评论

      本文标题:YAML

      本文链接:https://www.haomeiwen.com/subject/cjuofrtx.html