How can I import output from a command as a command in Bash?
As pLumo showed you, you can indeed source
them. However, I would recommend against this. If you have something like this:
source <(sed -n '/# Main configuration./,/# Websites./p' webcheck-$category.cfg | sed '1,1d' | sed '$ d')
echo "$email_sender"
Then, a year later when you come back and look at this script, you will have no idea where this email_sender
variable is coming from. I suggest you instead change the command and use one that returns only the variable's value and not its name. That way, you can easily keep track of where each variable comes from:
email_sender=$(grep -oP 'email_sender=\K.*' webcheck-$category.cfg)
email_recipients=$(grep -oP 'email_recipients=\K.*' webcheck-$category.cfg)
You can use process substitution:
source <(sed -n '/# Main configuration./,/# Websites./p' webcheck-$category.cfg | sed '1,1d' | sed '$ d')