Gentoo Archives: gentoo-user

From: Richard Fish <bigfish@××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] sudo echo cannot write to /etc/ files ?
Date: Thu, 07 Jul 2005 05:35:13
Message-Id: 42CCBE31.9060304@asmallpond.org
In Reply to: Re: [gentoo-user] sudo echo cannot write to /etc/ files ? by "Boyd Stephen Smith Jr."
1 Boyd Stephen Smith Jr. wrote:
2
3 >
4 > You want:
5 > sudo "echo 'media-video/xine-ui ~x86' >> /etc/portage/package.keywords"
6 >
7 No, I'm sorry, this is completely false.
8
9 Running
10
11 sudo "echo 'media-video/xine-ui ~x86' >> /etc/portage/package.keywords"
12
13 causes sudo to search the PATH for a *single* executable file named
14 "sudo echo 'media-video/xine-ui ~x86' >>
15 /etc/portage/package.keywords". It will find no such file, and report
16 "command not found".
17
18 Besides, the echo command doesn't support the *shell* redirection
19 operators. It is the *shell* that interprets those. Echo just prints
20 every argument it receives to stdout, so even if you managed to pass
21 ">>" to echo in it's argv, it would just print those characters to its
22 stdout.
23
24 > This cause the command
25 > echo 'media-video/xine-ui ~x86' >> /etc/portage/package.keywords
26 > to be passed to the sudo shell which causes the bash built-in:
27
28
29 sudo has no builtin bash or bash-like shell.
30
31
32 -Richard
33
34 --
35 gentoo-user@g.o mailing list