« Return to Thread: tmpwatch problem

Re: Aliasing (was Re: tmpwatch problem)

by Thomas Backlund :: Rate this Message:

Reply to Author | View in Thread

Anne Wilson skrev:

> On Friday 19 June 2009 10:21:31 David Guntner wrote:
>> Anne Wilson wrote:
>>> On Thursday 18 June 2009 22:35:37 Dick Gevers wrote:
>>>> On Thu, 18 Jun 2009 09:28:11 +0100, Anne Wilson wrote about Aliasing
>>>> (was
>>>>
>>>> Re: [Expert] tmpwatch problem):
>>>>>> For example:
>>>>>>
>>>>>> alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'
>>>>> Can that be done to add parameters?  I mean, for instance, on the F10
>>>>> netbook, I would like to alias 'yum update' to 'yum update
>>>>> --skip-broken'.
>>>> Sure: e.g. alias yus='yum update --skip-broken'.
>>>>
>>>> Obviously, if you run it with sudo you'd have to include 'sudo' in
>>>> front, and if run as root, you could either put your alias as before in
>>>> ~/.bashrc (which is then same as /root/.bashrc), or in any file in
>>>> /etc/profile.d . My root aliases are in /etc/profile.d/z_<boxname>.sh
>>> Thanks.  I'm trying this - putting it in ~/.bashrc.  Don't know whether
>>> it needs it, but I ran newaliases anyway.  Then I tried 'yus' but got
>>> 'command not found'.  What have I missed?
>> The newaliases command builds the aliases db hash table for
>> sendmail/postfix. :-)
>>
>> Your .bashrc file is only executed when a new shell is opened.  Close
>> the shell you're in after having put the alias command into it and open
>> a new shell window.  Or you can just type ". ~/.bashrc" to run it from
>> within the shell window in question (without the quotes, of course) so
>> you don't have to bring up a new shell.  Either way, your alias should
>> then be active.
>>
> Didn't think of that.  However, it's still not right.  From a user shell it
> says I have to be root (as expected) and from a root shell it says 'command
> not found'.  I'll have to try some of the alternatives Dick mentioned
>
> Anne

If you need the alias for root user, then you have yo put it in
/root/.bashrc

Then logout root and login again and it should work.
--
Thomas

 « Return to Thread: tmpwatch problem