From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5827 invoked from network); 26 Aug 1998 16:40:00 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 26 Aug 1998 16:40:00 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id MAA10563; Wed, 26 Aug 1998 12:33:19 -0400 (EDT) Resent-Date: Wed, 26 Aug 1998 12:33:08 -0400 (EDT) Sender: B.Stephens@isode.com To: ZSH users mailing list Subject: Re: Command alias in non-command position References: <000a01bdd108$27f40910$21c9ca95@ao13.mow.sni.de> Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII From: Bruce Stephens Date: 26 Aug 1998 17:35:05 +0100 In-Reply-To: "Andrej Borsenkow"'s message of "Wed, 26 Aug 1998 19:42:39 +0400" Message-ID: X-Mailer: Gnus v5.6.27/XEmacs 20.4 - "Emerald" Resent-Message-ID: <"YPGCQ1.0.Ta2.4Z3vr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1759 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu "Andrej Borsenkow" writes: > I have some often used aliases, e.g. > > vi=elvis > view='elvis -R' > etc > > Unfortunately, if I try to do e.g. > > sudo vi ... > > The /usr/bin/vi is started instead of elvis. > > Is there any easy way to use my lovely aliases in this case? An obvious immediate approach would be to use global aliases: alias -g vi=elvis Then vi will expand to elvis in lots of places, so "sudo vi" will run elvis. But "echo vi" will also print elvis, so perhaps this is too pervasive. Could I define sudo somehow, to say that its first argument ought to be expanded as if it were in the command position? (As a function, maybe?) Is this a case for configurable expansion? (I already think I ought to be able to change how spell-correction works, to say that some words just don't correspond to files (like the first argument to tar), and possibly to say that some words ought to correspond to non-existent files. This feels like a related feature.)