Holly Bostick wrote:
[EMAIL PROTECTED] schreef:
I think the problem come from the fact that echo is sudo-ed but the shell
redirection isn't.
Compare this:
su -c "echo foo > /etc/portage/whatever"
and
su -c "echo foo" > /etc/portage/whatever
The first one will succeed, but not the second.
Well, it didn't work (this to all the respondents).
"sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords"
This groups *everything* as one shell parameter, so it attempts to
execute a file named "sudo echo 'media-video/xine-ui ~x86'
>>/etc/portage/package.keywords" in your path.
/etc/portage/package.keywords: Onbekend bestand of map
("unknown file or folder")
Of course, since it's extremely unlikely a file with that name exists.
sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords
Now, you've completely left out the quotes, so the redirection is done
in the user shell, not the sudo shell. Of course, your user can't write
to that file so you get:
-bash: /etc/portage/package.keywords: Toegang geweigerd
(permission refused)
You want:
sudo "echo 'media-video/xine-ui ~x86' >> /etc/portage/package.keywords"
This cause the command
echo 'media-video/xine-ui ~x86' >> /etc/portage/package.keywords
to be passed to the sudo shell which causes the bash built-in:
echo
to be called with the single parameter
media-video/xine-ui ~x86
and have it's output appended to the file
/etc/portage/package.keywords
I'm really lost. Where am I going wrong?
You simply aren't being careful enough with you quotes and
misunderstanding the intricacies of shell expansion and nesting.
Oh, btw, just remembered-- this is bash 3. Does that make a difference?
No.
--
Boyd Stephen Smith Jr.
[EMAIL PROTECTED]
--
gentoo-user@gentoo.org mailing list