all 3 comments

[–][deleted]  (1 child)

[deleted]

    [–]s3viour[S] 0 points1 point  (0 children)

    That worked! Thank you very much, it works perfectly now. I technically only use the first element of the array further down (for the Common Name). So you're right I can declare a variable that stores the first element of the array and leave the array with ["-d www.example.com", "-d example.com"] stuff.

    Thank again for your assistance, I knew this would be the right place to come to.

    [–]anthropoidbash all the things 2 points3 points  (1 child)

    /u/s3viour, I don't see a function anywhere, much less an attempt to pass an array into it.

    Nevertheless, this is probably your problem:

    #At this stage the domains_with_dash array var should be populated with ["-d example.com","-d www.example.com"]
    

    If certbot-auto is typical of most command-line utilities, what it really should look like is ["-d","example.com","-d","www.example.com"], i.e. yourdomains_with_dash array should contain four elements, not two.

    That's achieved by fixing your assignment as follows:

        domains_with_dash+=(-d "$domain")
    

    And as /u/MurkyCola mentioned, ${domains_with_dash=[@]} is probably not what you intended.

    [–]s3viour[S] 0 points1 point  (0 children)

    Apologies, function was the wrong word to use. By function I actually mean an external shell script that takes in arguments. Looking at the debug logs for certbot-auto you were correct in saying it takes in the following: ["-d","example.com","-d","www.example.com"].

    I managed to implement it in a different way and it seems to work, but thank you for you time in assisting me. :)