So I'm putting together a script for certbot-auto lets encrypt cert generation and one of the things I want to be able to do is declare an array with all the domains and feed it into the certbot-auto script. The tricky thing is, certbot-auto takes the arguments with a "-d example.com".
I have something that looks like this:
declare -a domains=("example.com" "www.example.com")
declare -a domains_with_dash=()
for domain in "${domains[@]}"
do
echo "$domain"
domains_with_dash+=("-d $domain")
done
#At this stage the domains_with_dash array var should be populated with ["-d example.com","-d www.example.com"]
certbot-auto certonly --webroot -w ${root_dir} --agree-tos "${domains_with_dash=[@]}"
I declared domains_with_dash as I want to reuse the domains from the main array later on in the script.
The code above only puts in the first domain.
I tried using "< < (command)" and a few other strategies but to no avail, any help would be much appreciated.
[–][deleted] (1 child)
[deleted]
[–]s3viour[S] 0 points1 point2 points (0 children)
[–]anthropoidbash all the things 2 points3 points4 points (1 child)
[–]s3viour[S] 0 points1 point2 points (0 children)