正在try 读取.env文件并将其转换为json文件.
输入:
os=amazon-linux
region=ap-south-1
所需输出:
{
"os": "amazon-linux",
"region": "ap-south-1"
}
我正在try 使用JQ,但遇到了两个问题-
- 空行的句柄-
jq: error (at .env:1): null (null) only strings can be parsed
- 处理注释行-
#this is comment
=>;"#this is comment": null
注意:.env文件不是嵌套值文件