Do someone know how to check if a PPA is already added to my system before i add it with the add-apt-repository
command in a shell script
.
That would be very helpful.
Thank you.
Do someone know how to check if a PPA is already added to my system before i add it with the add-apt-repository
command in a shell script
.
That would be very helpful.
Thank you.
You can do something like this:
Notes:
grep
exits with success if it finds a match!
negates this, so the commands will be executed if there is no match = ppa not added-q
flag makesgrep
quiet, so it doesn't print the matched lines. It would be just noise, we need only to know if there is a match or not, for which the exit code is perfect^deb .*
prefix is to make sure the matched line starts withdeb
, to exclude lines that are commented outOpen your terminal and type this command
replace fogger with PPA name.
Removing list.save files, sources, ensure only deb lines and count it for "fogger" ppa: