shell 读取yaml 之 shyaml

安装shyaml
pip3.7 install shyaml



(testenv3.7) localhost:testenv3.7 macname$ vi file.yaml
写入
---
idc_group:
  name: bx
  bx: 
    news_bx: news_bx
    web3_bx: web3_php-fpm_bx




(testenv3.7) localhost:testenv3.7 macname$ cat file.yaml | shyaml get-value idc_group.name
bx
(testenv3.7) localhost:testenv3.7 macname$ 
(testenv3.7) localhost:testenv3.7 macname$ cat file.yaml | shyaml key-values idc_group.bx
news_bx
news_bx
web3_bx
web3_php-fpm_bx
(testenv3.7) localhost:testenv3.7 macname$ 

参考:

https://www.linuxidc.com/Linux/2016-04/130403.htm

猜你喜欢

转载自www.cnblogs.com/sea-stream/p/11983825.html