JimD schreef: > I have been using Linux for a number of years and the one "trick" I > have never read how to do is something like: > > sudo echo "app-portage/porthole ~*" >> /etc/portage/package.keywords
Well this one I do with a set of revised command nicked from the list, entered into ~/.bashrc, and requiring that 1) "su" is one of the commands that you are allowed to execute via sudo 2) you are exempted from needing to enter a password for 'sudo su': addkey(){ sudo su -c "echo $* >> /etc/portage/package.keywords" } adduse(){ sudo su -c "echo $* >> /etc/portage/package.use" } addmask(){ sudo su -c "echo $* >> /etc/portage/package.mask" } addunmask(){ sudo su -c "echo $* >> /etc/portage/package.unmask" } The general idea being that a) sudo seems to be a bit weird; even though it allows you to perform operations as if you are root, it doesn't do so by pretending that you _are_ root, so you still couldn't write to the /etc/portage/package.* files; b) su does pretend you are root, but "su" alone only just re-logs you in, rather than actually allowing you to execute a command-- unless you use the "-c" switch. su -c then says, "whatever follows this switch is a command that you should execute as root". But of course, since "echo $* (where $* stands for "what I typed after addkey") >> /etc/portage/package.* is a complex command, containing spaces, the syntax of the command following sudo su -c needs to be quoted. > > Another one I always wanted to know if it is possible is: > > sudo > /var/log/foo.log I'm sure it is, with a bit of creativity, though I honestly don't know what your intention is in any case, since this looks to me like you're logging the output of the sudo command to foo.log (but since there is no output really to typing 'sudo', I have no idea what result you might expect). Anyway, hope this is to some degree helpful; what you most likely want to do is read up on bash scripting to understand how to chain the commands that do what you want to get done with sudo. Depending on your goals, you might also consider aliasing (alias etc-update="sudo etc-update"), and fine-tuning your visudo to allow you to run specific apps with sudo, preferably without a password, since if you have to type the password everytime you want to do sudo emerge, you might as well just su, imo. Good luck, Holly -- gentoo-user@gentoo.org mailing list