Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to complete alias after alias of sudo?



On Fri, 2 Jun 2017 11:57:46 +0800
Han Pingtian <hanpt@xxxxxxxxxxxxxxxxxx> wrote:
> Thanks. But looks like the situation is a bit different. I have aliased
> 'sd' to 'sudo -i ', so another alias after 'sd' will be expanded before
> command running. So the alias won't be passed to another shell. But
> looks like it's not easy to enable alias completion in this situation?

Possibly my patch --- which I think ought to do what you want in this
as a side effect --- is the best we've got?  To be clear:

Your case: you have a special alias for "sudo -i" so that the next word
is expanded at an alias in the current shell --- before sudo is called.

Standard case: "sudo -i" runs the command in a shell, so it will use
whatever shell environment has been provided in the sudo environment.
In general we don't know what that is, and quite like using the local
environment for completing functions and aliases isn't right.  But
without much more digging this may be the best solution.

pws



Messages sorted by: Reverse Date, Date, Thread, Author