Zsh Mailing List Archive
Messages sorted by:
Re: --init-file option
- X-seq: zsh-workers 51424
- From: Kalmár Gergely <kgregory89@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: --init-file option
- Date: Mon, 13 Feb 2023 14:43:59 +0100
- Archived-at: <https://zsh.org/workers/51424>
- In-reply-to: <CAN=4vMqxKA6yzJgfJZ5cCRT8htPL9pi1NYpeeb+fws04oK3+kQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAKue2cS2c8TuUgWQxOYjgJ9pEnGb7mx-9RZRD-FnWO2afmvv8g@mail.gmail.com> <CAN=4vMqxKA6yzJgfJZ5cCRT8htPL9pi1NYpeeb+fws04oK3+kQ@mail.gmail.com>
Thank you! Yes, I'm already using the -c 'source xxx; command' approach with Bash/fish, and you are right, it should work with Zsh too of course. Nonetheless, the problem of starting Zsh with an activated virtual environment remains.
I suppose the next question is if the maintainers would consider adding this feature to Zsh to support use cases like these, just as Bash/fish do (which is why I thought writing to zsh-workers instead of zsh-users was perhaps going to be more appropriate).
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
If you are executing a script or a command, then instead of this:
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: