The following snippet of a bash script appears to function:
CF_Key=${CF_GLOBAL_API} CF_Email=${CF_EMAIL} ${ACME_PATH} --test --staging --issue --dns dns_cf -d ${DOMAIN_NAME}
However if I declare a variable and attempt to pass it to the script this does not:
ENV="CF_KEY=${CF_GLOBAL_API} CF_Email=${CF_EMAIL}"
${ENV} ${ACME_PATH} --test --staging --issue --dns dns_cf -d ${DOMAIN_NAME}
CF_Key=bsif987: command not found
I've even tried
"${ENV} ${ACME_PATH} --test --staging --issue --dns dns_cf -d ${DOMAIN_NAME}"
CF_Key=bsif987 CF_Email=user@example.com /root/.acme.sh/acme.sh --test --staging --issue --dns dns_cf -d test.gohilton.com: No such file or directory
Do I export the variables rather than pass them on command line?
env
utility would probably work in this case:env ${ENV} ${ACME_PATH} --test ...
. – Mar 20 '20 at 21:08ENV
variable, you could use a wrapper function:cf_env(){ CF_FOO=foo CF_BAR=bar CF_BAZ=baz "$@"; }; ...; cf_env "$ACME_PATH" ...
– Mar 20 '20 at 21:11env
oreval
to do what you hope to do. And many will say, if you need to useeval
you need to find another way to do it. – glenn jackman Mar 20 '20 at 22:19export
the variables first, then call "$ACME_PATH" without the preamble. – glenn jackman Mar 20 '20 at 22:21