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

Re: sudo user-command-1; also-sudoed-command-2



On Mon, May 16, 2016 at 10:22 AM, Emanuel Berg <embe8573@xxxxxxxxxxxxx> wrote:
> How can I execute a block of arbitrary commands
> with sudo, but only having to type sudo once,
> and still be able to use the user functions?

Why not

  sudo ZDOTDIR="${ZDOTDIR:-$HOME}" zsh -c "...."

??  That should cause zsh to read the current user's .zshrc etc. files
before executing the "...", thereby obtaining the alias and function
definitions.



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