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

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



Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
writes:

>> 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
> "...."
>
> ??

You mean:

    zzudo () { sudo ZDOTDIR="${ZDOTDIR:-$HOME}" zsh -c $1}

and then provide a string as input, e.g.

    $ zzudo ll /

?

I don't get that to work with 'll', the user
ls alias: "command not found: ll"

I don't have ZDOTDIR set by the way.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 32 Blogomatic articles -                   



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