I want to do something along the lines of:
echo "Append string" >> protected_file
However, as this file is write protected I get an error. Running:
sudo echo "Append string" >> protected_file
seems to run sudo on the echo command, and still gives me the permission error, how do I append to this file?
sudo
your shell script, not theecho
command.