有趣的bash脚本随记:修订间差异
来自三线的随记
(创建页面,内容为“ # see <nowiki>https://www.mediawiki.org/wiki/Parsoid/Setup#Configuration</nowiki> for var in $domains do if [ -z "${!var}" ]; then echo >&2 "The $va…”) |
小无编辑摘要 |
||
(未显示同一用户的2个中间版本) | |||
第1行: | 第1行: | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | |||
<br /> | |||
domains="${!PARSOID_DOMAIN_*} ${!PARSOID_MWAPIS_*}" | |||
if [ -z "$domains" ]; then | |||
echo >&2 'You must provide PARSOID_DOMAIN_* variables, for example: export PARSOID_DOMAIN_localhost=<nowiki>http://localhost/w/api.php'</nowiki> | |||
exit 2; | |||
fi | |||
# see <nowiki>https://www.mediawiki.org/wiki/Parsoid/Setup#Configuration</nowiki> | # see <nowiki>https://www.mediawiki.org/wiki/Parsoid/Setup#Configuration</nowiki> | ||
for var in $domains | for var in $domains | ||
第12行: | 第23行: | ||
EOT | EOT | ||
done | done | ||
<br /> | <br />https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html#Shell-Parameter-Expansion | ||
[[分类:Todo]] | [[分类:Todo]] | ||
[[分类:Linux]] | [[分类:Linux]] | ||
[[分类:Bash]] | [[分类:Bash]] | ||
{{DEFAULTSORT:interesting}} | {{DEFAULTSORT:interesting}} |
2021年1月9日 (六) 00:04的最新版本
cd "$(dirname "${BASH_SOURCE[0]}")"
domains="${!PARSOID_DOMAIN_*} ${!PARSOID_MWAPIS_*}" if [ -z "$domains" ]; then echo >&2 'You must provide PARSOID_DOMAIN_* variables, for example: export PARSOID_DOMAIN_localhost=http://localhost/w/api.php' exit 2; fi
# see https://www.mediawiki.org/wiki/Parsoid/Setup#Configuration for var in $domains do if [ -z "${!var}" ]; then echo >&2 "The $var variable must not be an empty string"; fi cat <<EOT >> config.yaml - uri: '${!var}' domain: '${var:15}' EOT done