Then this would be the first part, but cleared up.
Code:
#!/bin/bash
shopt -s globstar
pattern='^deb http://ppa.launchpad.net/[a-z0-9-]+/[a-z0-9-]+'
ExistingPPAs=$( tempfile )
while IFS='/' read _ _ _ user ppa
do
echo "ppa:$user/$ppa"
done < <( grep -Eho "$pattern" /etc/apt/**/*.list ) > $ExistingPPAs
At the moment this would have been the old way:
Code:
function addit { # Adds ppa if it doesn't exist.
for PPAx in $1; do if ! grep -oqs $PPAx $ExistingPPAs; then add-apt-repository -y $PPAx; fi; done
}
addit "ppa:nvbn-rm/ppa" # Everpad | 13.10 14.04
addit "ppa:ubuntu-wine/ppa" # Wine Team | 13.10 14.04
addit "ppa:libreoffice/ppa" # Libreoffice | 13.10 14.04
Updated this way. Correct?
Code:
function addit { # Adds ppa if it doesn't exist.
for PPAx in "$@"; do if ! grep -oqs $PPAx $ExistingPPAs; then add-apt-repository -y $PPAx; fi; done
}
addit "ppa:something/something ppa:something_else/something_else ppa:etc_app/etc_app"
Bookmarks