Add to / etc / apt / sources.list

I am creating several scripts to simplify the installation of applications, and I need to add /etc/apt/sources.list to the end

This code below is added to the files in ~, but not in / etc / apt /

echo "deb http://ppa.launchpad.net/person/ppa/ubuntu karmic main" >> /etc/apt/sources.list 

@meder

I tried the following commands with no luck:

 sudo echo "deb http://ppa.launchpad.net/person/ppa/ubuntu karmic main" >> /etc/apt/sources.list #===--- sudo sh "echo 'deb http://ppa.launchpad.net/person/ppa/ubuntu karmic main' >> /etc/apt/sources.list" 
+3
linux bash ubuntu
Oct 18 '09 at 5:09
source share
2 answers

This will work:

 sudo sh -c "echo 'deb http://ppa.launchpad.net/person/ppa/ubuntu karmic main' >> /etc/apt/sources.list"

However, instead of editing /etc/apt/sources.list it’s easier to add a new *.list file to /etc/apt/sources.list.d .

For example,

 echo 'deb http://ppa.launchpad.net/person/ppa/ubuntu karmic main'> /tmp/myppa.list
 sudo cp /tmp/myppa.list /etc/apt/sources.list.d/
 rm /tmp/myppa.list
+20
Oct 18 '09 at 5:21
source share

make sure you have a backup file

 echo "foo" | sudo tee -a /etc/apt/sources.list 

However, I would recommend that you create a new .list, and then use this method to add, save it to /etc/apt/sources.list.d/

+3
Oct 18 '09 at 5:11
source share



All Articles