It doesn't work because who wrote the original script (you can look at it, it's a python script) didn't think that could be useful.
The rationale may be that adding a repository is a thing that is better done slowly. You should check the signature for example --- and double check you really want it.
So it's basically a design decision. You could probably easily modify the script if you want it, or repeating the command on the command line...
for i in ppa:noobslab/malys-themes ppa:alecive/antigone ppa:nitrux/nitrux-artwork ppa:upubuntu-com/themes; do sudo add-apt-repository $i; done
(is that a script or not? A rose is a rose under another name?)
Don't do this, but... unix is famous for letting user shooting themselves in the foot,so...
If you really want your "multiple add-apt-repository"(1) work, do this:
1) find where add-apt-repository is.
(0)samsung-romano:~% which add-apt-repository
/usr/bin/apt-add-repository
2) rename it
(0)samsung-romano:~% sudo mv /usr/bin/add-apt-repository /usr/bin/add-apt-repository.real
3) replace it with a simple script:
(0)samsung-romano:~% sudo gedit /usr/bin/add-apt-repository
with the contents:
#! /bin/bash
#
for i in "$@"; do
/usr/bin/add-apt-repository.real "$i"
done
4) make it executable:
(0)samsung-romano:~% chmod a+rx /usr/bin/add-apt-repository
5) and now you can use your command:
(0)samsung-romano:~% sudo add-apt-repository ppa:noobslab/malys-themes ppa:alecive/antigone ppa:nitrux/nitrux-artwork ppa:upubuntu-com/themes
Why you should not do it? Because next time there will be an update to the package that contains the original apt-add-repository
, problems will arise. Like having your script overwritten or (worst) not having the package updated.
It is in effect much better to avoid touching the system program and simply put the script in your ~/bin
with another name, like my_aptadd
. You are now safe and happy.
Or if you are really fond of the original name, you can create a directory in your home folder like ~/override
, prepend it to your PATH in .profile
(like export PATH=$HOME/override:$PATH
), and save the script there --- obviously with the full path, original /usr/bin/add-apt-repository
in it to avoid an infinite loop. You will then regret it when someone will drop a file called "ls" in it with content exe rm $*
(2), but hey...
So why I wrote it here? Because this is really a useful technique sometime to "fix" programs that otherwise will not run. For example, I have this to add environment variables to programs that otherwise will misbehave, and that are called by other programs that I can't or won't modify.
Footnotes:
(1) I never noticed before but in my system exists even apt-add-repository
, which is a symlink to add-apt-repository
. I can understand why, but it's a call for a mess waiting to happen...
(2) it's wrong. On purpose.
add-apt-repository
command, you can be able to add only one PPA at a time. – Avinash Raj Mar 06 '14 at 14:15sudo add-apt
lines and paste them directly into your terminal. That will cause them to be added sequentially but with a single click from you. – terdon Mar 07 '14 at 17:58