From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27740 invoked from network); 2 Jun 2003 05:54:56 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 Jun 2003 05:54:56 -0000 Received: (qmail 7197 invoked by alias); 2 Jun 2003 05:54:44 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6139 Received: (qmail 7190 invoked from network); 2 Jun 2003 05:54:44 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 2 Jun 2003 05:54:44 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [192.35.17.28] by sunsite.dk (MessageWall 1.0.8) with SMTP; 2 Jun 2003 5:54:44 -0000 Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.11.7/8.11.7) with ESMTP id h525sh512136; Mon, 2 Jun 2003 07:54:43 +0200 (MEST) Received: from MOWD019A.mow.siemens.ru ([163.242.196.119]) by mail3.siemens.de (8.11.7/8.11.7) with ESMTP id h525sg612796; Mon, 2 Jun 2003 07:54:42 +0200 (MEST) Received: by mowd019a.mow.siemens.ru with Internet Mail Service (5.5.2653.19) id ; Mon, 2 Jun 2003 09:59:36 +0400 Received: from mw2b210c (163.242.193.12 [163.242.193.12]) by MOWD019A.mow.siemens.ru with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id L96NMVW8; Mon, 2 Jun 2003 09:59:31 +0400 From: Borzenkov Andrey To: "'Eric Mangold'" , zsh-users@sunsite.dk Subject: RE: using command aliases with sudo Date: Mon, 2 Jun 2003 09:54:32 +0400 Message-ID: <6134254DE87BD411908B00A0C99B044F05A0C92F@mowd019a.mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 In-Reply-To: <200305280204.44215.teratorn@world-net.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal > Hi, >=20 > I'm thinking of writing an extension to zsh that makes aliases work = with > sudo. >=20 > For example, I have an alias agi=3D"apt-get install", since this = needs root > I > often find myself typing "sudo agi foo", which of course doesn't = work. >=20 > If someone has already done this or has suggestions for an = implementation, > please reply :) >=20 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.=20 Extension to zsh makes no sense as sudo is started as external process = that you have no control of. -andrey