I have a command that takes domain names as options. I have a long list of domain names to include and so I'd like to automate the parsing of that list of domains into the command.
For example, the simplest usage would be command --option=example-one.com --output=file.ext
. After adding the list of domains the eventual command to execute would look like command --option=example-one.com ... --option=example-99.io --output=file.ext
(where '...' would be 97 more options, shown abbreviated here)
Is this possible to do in Bash and if yes, what's it called please?
Here's what I tried that didn't work so far:
command --option=$(cat domains.txt) --output=file.ext
command "$(while read baddomains ; do echo -n '--option=$baddomains ' ; done < domains.txt)" --output=file.ext
command --option="domains.txt" --output=file.ext
The command while read baddomains ; do echo -n '--option=$baddomains ' ; done < domains.txt > all-options.txt
does output a list of perfectly formatted options into a new file all-options.txt, but I can't understand how to redirect output of the options back into the command, instead of a text file.
The list of domains includes Cyrillic characters, if that matters.