In this example I will use the sources.list file that contains a list of the repositories from which we can get packages.
Firstly:
Results in a "Permission denied error". This is because anything after the IO redirection characters (>>), is inside a new subshell which is executed as you and not root. ie: sudo only applies to the echo command. Ways around this:
1)
Commands are read from string after the -c switch.
2)
The 'tee' command reads from standard input and the -a switch appends it to the file.
3)
No page links to IORedirectionNotes.