Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: using command aliases with sudo
- X-seq: zsh-users 6139
- From: Borzenkov Andrey <Andrey.Borzenkov@xxxxxxxxxxx>
- To: "'Eric Mangold'" <teratorn@xxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: RE: using command aliases with sudo
- Date: Mon, 2 Jun 2003 09:54:32 +0400
- Importance: Normal
- In-reply-to: <200305280204.44215.teratorn@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
> Hi,
>
> I'm thinking of writing an extension to zsh that makes aliases work with
> sudo.
>
> For example, I have an alias agi="apt-get install", since this needs root
> I
> often find myself typing "sudo agi foo", which of course doesn't work.
>
> If someone has already done this or has suggestions for an implementation,
> please reply :)
>
One possible solution would be
sudo() {
... add sudo options parsing here that sets sudo_options and
sudo_command...
command sudo $sudo_options zsh -c "$sudo_command"
}
with obvious caveat that you have to modify sudoers to account for this.
Extension to zsh makes no sense as sudo is started as external process that
you have no control of.
-andrey
Messages sorted by:
Reverse Date,
Date,
Thread,
Author