zsh-users
 help / color / mirror / code / Atom feed
From: Borzenkov Andrey <Andrey.Borzenkov@siemens.com>
To: "'Eric Mangold'" <teratorn@world-net.net>, zsh-users@sunsite.dk
Subject: RE: using command aliases with sudo
Date: Mon, 2 Jun 2003 09:54:32 +0400	[thread overview]
Message-ID: <6134254DE87BD411908B00A0C99B044F05A0C92F@mowd019a.mow.siemens.ru> (raw)
In-Reply-To: <200305280204.44215.teratorn@world-net.net>

> 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


  reply	other threads:[~2003-06-02  5:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-28  7:04 Eric Mangold
2003-06-02  5:54 ` Borzenkov Andrey [this message]
2003-06-02  6:24   ` Danek Duvall
2003-06-02  6:35     ` Borzenkov Andrey
2003-06-02  6:23 ` Stephen Rueger
2003-06-02  6:36 ` Wayne Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6134254DE87BD411908B00A0C99B044F05A0C92F@mowd019a.mow.siemens.ru \
    --to=andrey.borzenkov@siemens.com \
    --cc=teratorn@world-net.net \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).