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

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



"Nikolay Aleksandrovich Pavlov (ZyX)"
<kp-pav@xxxxxxxxx> writes:

> Why should it read zshrc without -i? If I am
> not mistaking using `sudo zsh -ic "…"` should
> be enough (assuming sudo keeps both $HOME and
> $ZDOTDIR, I do not remember this).

My neither, but anyway it doesn't work, at
least not here:

    $ sudo zsh -ic 'll /'

gets:

    zsh:1: command not found: ll

> (changed `$=` to `$(z)`). This will not run
> cycles though.

OK, done.

> You may change zudo-f to
>
> ```zsh zudo-f () { emulate -L zsh sudo
> ZDOTDIR="${ZDOTDIR:-$HOME}" zsh -ic "$1" } ```
>
> , but this has different downside: if alias or
> function was defined in user configuration
> everything may be fine. But if it was defined
> in the interactive session, it will not be
> used. Also this is going to be slower then
> your variant.

None of that is a problem to me, so let's see -
like this?

    zzzudo () {
        emulate -L zsh sudo ZDOTDIR="${ZDOTDIR:-$HOME}" zsh -ic "$1"
    }

If so, no:

    zzzudo:emulate:1: unknown argument sudo

-- 
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