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

Re: --init-file option

On Mon, Feb 13, 2023 at 11:58 AM Kalmár Gergely <kgregory89@xxxxxxxxx> wrote:
> I was wondering if there is an equivalent to Bash's --init-file
> option or fish shell's --init-command option in Zsh or if one can
> hack around to achieve the same effect. I would need to be able to
> source a virtual environment activation file after the Zsh startup
> files were processed (but before a command is executed) in order to
> be able to start a shell or run commands inside a Python virtual
> environment.

If you are executing a script or a command, then instead of this:

    zsh foo
    zsh -c 'foo'

you can do this:

    zsh -c 'source /path/to/your/file; foo'

If you need to start an interactive zsh that sources an extra file
after the usual startup files, and if you cannot modify any of the
standard startup files, then https://github.com/romkatv/zshi or
something like it is the only option. Disclaimer: It's my project but
I'm not using this code myself.


This question is more suitable for zsh-users than zsh-workers.

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