From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: ZSH Users <zsh-users@sunsite.auc.dk>
Subject: making sudo work with functions/builtins
Date: Mon, 15 Feb 1999 19:15:09 -0500 [thread overview]
Message-ID: <19990215191509.A28737@astaroth.nit.gwu.edu> (raw)
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@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>
next reply other threads:[~1999-02-16 0:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-16 0:15 Sweth Chandramouli [this message]
1999-02-16 22:41 ` Wayne Davison
1999-02-17 5:30 ` Bart Schaefer
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=19990215191509.A28737@astaroth.nit.gwu.edu \
--to=sweth@astaroth.nit.gwu.edu \
--cc=zsh-users@sunsite.auc.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).