6
3
This question is of course related, but different to the one about executing a command.
That questions’ solutions involve either starting a subshell – which isn’t possible due to the requirement of sourcing instead of executing – or modifying your ~/.zshrc
, which isn’t possible if you want to distribute a script that does it. (Or rather modifying the user’s config files is a thing you just don’t do)
The problem is that with zsh there is no --init-file
parameter like bash has (the first time ever i saw bash having a feature that zsh hasn’t)
I’ll provide an answer with my question, but it’s reeeaaallly ugly, and I hope someone knows a trick to circumvent it!
To update an old question, I'm looking for the same thing. My use case is to use an iTerm profile to launch a particular environment (simply, setting
$GOPATH
andcd
ing there). Frankly, I'm very surprised this doesn't exist – nfirvine – 2016-01-22T01:27:30.2501If you are distributing a script, can't you just add the commands to the top of the script (or at least a
source
command to source the appropriate file). I think I'm missing the rationale for the question. – chepner – 2013-05-04T16:52:53.440No, the script should be sourced from inside a shell that has some environment variables set, after the user’s rc files have been sourced. all that automatically. – flying sheep – 2013-05-05T13:58:43.830
Are you looking for something like
– mpy – 2013-05-05T14:24:02.210modules
(http://modules.sourceforge.net)?Wow, that would be total overkill :) thanks though! Well, in fact I would like a simpler solution than the one I provided below, not a more complicated one… – flying sheep – 2013-05-05T20:12:16.710