5
版本:v2.12.1
在青龙面板里添加一些多行的环境变量时,会出现一些奇怪的问题,例如:
1. 空格丢失想要添加如下CURL
变量:
curl -k -X GET -H "Content-Type: application/json" -H "Host: example.com" -H "Connection: keep-alive" "https://example.com"
在env.sh文件中会变成如下所示,失去了空格:
export CURL='curl-k-XGET-H"Content-Type:application/json"-H"Host:example.com"-H"Connection:keep-alive""https://example.com"'
2. 引号转译问题
想要添加如下CURL
变量:
curl 'https://example.com' \
-H 'authority: example.com' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'accept-language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7' \
-H 'dnt: 1' \
-H 'referer: https://example.com' \
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--compressed
在env.sh文件中会变成如下所示,单引号字符串错了(空格也丢失了):
export CURL='curl'https://example.com'\
-H'authority:example.com\
-H'accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'\
-H'accept-language:en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7'\
-H'dnt:1'\
-H'referer:https://example.com/'\
-H'sec-ch-ua:"NotA;Brand";v="99","Chromium";v="100","GoogleChrome";v="100"'\
-H'sec-ch-ua-mobile:?0'\
-H'sec-ch-ua-platform:"macOS"'\
--compressed'