1
How do I get commands to accept all possibilities in the code? (Generic)
I am trying to make an automation script to install all the programs I regularly use in Ubuntu 20.04.
In this case I try to add a repository key using wget but it doesn’t work!
keys_repository=( "https://brave-browser-apt-release.s3.brave.com/brave-core.asc" )
echo "Downloading repository keys..." && sleep 1
for key in ${keys_repository[@]}; do
wget -q $key -O- | apt-key add -
done
In this other case I try to add the repositories but it also doesn’t work because I don’t know how to make the most generic command possible!
arch_repositories=( "[arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"
"[arch=amd64] https://packages.microsoft.com/repos/vscode stable main" )
echo "Adding repositories deb..." && sleep 1
for repository in ${repositories[@]}; do
apt-add-repository "deb "$repository -y
done
How can I solve?
See an example of an installer and notice the chain of ifs: https://github.com/rbenv/rbenv-installer/blob/main/bin/rbenv-installer
– vinibrsl