1 |
On Thursday 23 March 2006 16:33, JimD <Jim@×××××××××××××××××.org> wrote |
2 |
about 'Re: [gentoo-user] sudo echo': |
3 |
> If you type something like the following: |
4 |
> |
5 |
> "> /tmp/myfile.foo" |
6 |
> |
7 |
> It will truncate the file. I use it when I want to clear out logs real |
8 |
> quick. I can sudo su and then just type (without the quotes): |
9 |
> |
10 |
> "> /var/log/mail/current" |
11 |
> |
12 |
> and have a clean log. However to do that I need to be root and the |
13 |
> only thing I found is to sudo su and then type the command and then |
14 |
> exit from root. |
15 |
|
16 |
Try: |
17 |
sudo /bin/bash -c '> /var/log/mail/current' |
18 |
or, if that doesn't work: |
19 |
sudo /bin/bash -c ': > /var/log/mail/current' |
20 |
|
21 |
Shells handle redirection and pipes, sudo does not, AFAIK. |
22 |
|
23 |
-- |
24 |
"If there's one thing we've established over the years, |
25 |
it's that the vast majority of our users don't have the slightest |
26 |
clue what's best for them in terms of package stability." |
27 |
-- Gentoo Developer Ciaran McCreesh |
28 |
-- |
29 |
gentoo-user@g.o mailing list |