PDA

View Full Version : [bash]writing text to write protected file



Jordanwb
September 30th, 2009, 02:12 AM
I'm making a bash script that will be run as non-root but will need root privileges when needed. Currently I'm trying to echo "deb http://wine.budgetdedicated.com/apt jaunty main" to /etc/apt/sources.list This is what I have so far:


#!/bin/sh

echo "deb http://wine.budgetdedicated.com/apt jaunty main" | sudo /etc/apt/sources.list
tail /etc/apt/sources.list

I'm not sure what to put between sudo and the file path.

falconindy
September 30th, 2009, 03:16 AM
sudo tee -a /etc/apt/sources.list

Jordanwb
September 30th, 2009, 03:19 AM
Thanks.