Reputation: 4756
I would like to auto generate my debian system virtualbox with provisionning. I must install don't standard or default PHP environment. I must add repository dotdeb for find special package PHP for 5.3 version.
My shell provisionning script must edit /etc/apt/sources.list for adding line corresponding to dotdeb repository. This line are :
deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all
How can edit my file with sed command for result this :
#
# deb cdrom:[Debian GNU/Linux 7.11.0 _Wheezy_ - Official amd64 NETINST Binary-1 20160605-17:36]/ wheezy main
#deb cdrom:[Debian GNU/Linux 7.11.0 _Wheezy_ - Official amd64 NETINST Binary-1 20160605-17:36]/ wheezy main
deb http://httpredir.debian.org/debian wheezy main
deb-src http://httpredir.debian.org/debian wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all
The default content file of /etc/apt/sources.list is :
#
# deb cdrom:[Debian GNU/Linux 7.11.0 _Wheezy_ - Official amd64 NETINST Binary-1 20160605-17:36]/ wheezy main
#deb cdrom:[Debian GNU/Linux 7.11.0 _Wheezy_ - Official amd64 NETINST Binary-1 20160605-17:36]/ wheezy main
deb http://httpredir.debian.org/debian wheezy main
deb-src http://httpredir.debian.org/debian wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
Finally, I just want to add a empty line at the end of file and after add to specific line. But I don't find how add empty line at the end of file and add specific line with multi special character with sed command...
Upvotes: 1
Views: 2362
Reputation: 4635
sed -i '$ a\\ndeb http://packages.dotdeb.org wheezy all\ndeb-src http://packages.dotdeb.org wheezy all' /etc/apt/sources.list
Upvotes: 1
Reputation: 133650
If you simply want to add a new line at last of Input_file do following.
echo "" >> Input_file
Upvotes: 1