Differences between version 5 and previous revision of IORedirectionNotes.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 5 | Last edited on Monday, December 11, 2006 8:46:29 pm | by BenStaz | Revert |
Older page: | version 4 | Last edited on Monday, December 11, 2006 8:43:00 pm | by BenStaz | Revert |
@@ -5,14 +5,14 @@
Firstly:
*sudo echo "#TEST REPOSITORY" >> /etc/apt/sources.list
-Results in a "Permission denied error". This is because ''
sudo'' ONLY
applies to the echo command and nothing else
.
+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)
-*sudo bash -c 'echo "#TEST REPOSITORY" >> /etc/apt/sources.list'
+*sudo bash -c 'echo "#TEST REPOSITORY" >> /etc/apt/sources.list'ers
Commands are read from string after the ''-c'' switch.
2)