Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
making sudo work with functions/builtins
- X-seq: zsh-users 2160
- From: Sweth Chandramouli <sweth@xxxxxxxxxxxxxxxxxxxx>
- To: ZSH Users <zsh-users@xxxxxxxxxxxxxx>
- Subject: making sudo work with functions/builtins
- Date: Mon, 15 Feb 1999 19:15:09 -0500
- Mail-followup-to: ZSH Users <zsh-users@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
a while ago, someone asked about how to deal with the following
sort of situation:
% alias mv='nocorrect mv'
% alias sudo='sudo '
% sudo mv foo bar
sudo: nocorrect: command not found
from what i can tell, this happens because sudo requires that its
first argument be an actual command, and not a builtin or a function;
adding the space after sudo in the alias makes expansion take place on cp,
so that what sudo sees as the first arg is 'nocorrect'. i just had a
little brainstorm about how to get around this:
% alias mv='nocorrect mv'
% ls
cmd foo
% alias sudo='sudo cmd '
% cat cmd
#!/bin/sh
eval $SHELL -c \"$@\"
% sudo mv foo bar
% ls
bar cmd
%
my question is twofold--is there a more efficient way to do
this, and can anyone see a situation where this would break something
that would otherwise work?
-- sweth.
--
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@xxxxxxx> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author