Am试图在";此处文档";与预期的certbot一起使用:
myArray+=( "sub1.domain.org" "sub2.domain.org" )
echo ${myArray[@]}
expect <(cat << EOF
certbot --apache
"${myArray[@]}"
for val in "${myArray[@]}"; do
-d "${val}"
done
EOF
)
最终结果应该是:
certbot --apache -d sub1.domain.org -d sub2.domain.org
然后我必须用期望来回应https://linux.die.net/man/1/expect回答问题,但我的循环不起作用。
构建第二个数组以包含certbot
:的参数
args=(--apache)
for val in "${myArray[@]}"; do
args+=(-d "$val")
done
cerbot "${args[@]}"