• eval some complicated commands directly.

    From [email protected]@21:1/5 to All on Sat Feb 26 07:33:07 2022
    I use pyenv [1] on Ubuntu 20.04.3 LTS, which needs the following configuration in ~/.bashrc:

    ```
    eval "$(pyenv init -)"
    ```

    The `pyenv init -` called above will be expanded into the following when evaluated:

    ```
    $ pyenv init -
    export PYENV_SHELL=bash
    source '/home/werner/Public/repo/github.com/pyenv/pyenv.git/libexec/../completions/pyenv.bash'
    command pyenv rehash 2>/dev/null
    pyenv() {
    local command
    command="${1:-}"
    if [ "$#" -gt 0 ]; then
    shift
    fi

    case "$command" in
    activate|deactivate|rehash|shell)
    eval "$(pyenv "sh-$command" "$@")"
    ;;
    *)
    command pyenv "$command" "$@"
    ;;
    esac
    }
    ```

    Now, I want to eval of slightly revised version of the above `pyenv init -`, which means that I must eval these complicated commands directly. I tried with the following method:


    ```
    eval "$(
    # Here comes the revised version of the above `pyenv init -`
    ...
    )"
    ```

    But it seems this method doesn't work, especially, the following line in the original version of `pyenv init -`, which adds the bash completion for pyenv doesn't work in my revised one:

    source '/home/werner/Public/repo/github.com/pyenv/pyenv.git/libexec/../completions/pyenv.bash'

    Any hints to make a completely equivalently eval with these complicated commands directly?

    [1] https://github.com/pyenv/pyenv

    Regards,
    HZ

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)