Due to constraints at my workplace, the default shell for every user is tcsh
, and I am required to use tcsh
as my non-interactive shell (i.e. we do most of the environment configuration across projects in tcsh
init files). However, I like using zsh
as my interactive shell.
In order to inherit the environment from tcsh
when I switch to zsh
, I usually first start an interactive shell in tcsh
and later switch to zsh with exec zsh
. This seems to be working well.
However, sometimes we update our tcsh
init files, and I need to refresh my environment accordingly from a runningzsh
shell. I believe the best way to approach this problem is to switch to tcsh
to source its init filts and then switch back to zsh
.
In practice I resort to the following
> # Running from a zsh interactive shell.
> # Various tcsh and zsh init files have been updated
> exec tcsh
> exec zsh
> # I am back to zsh with the updated environment
But I am wondering several things:
Is there a way of collapsing
> exec tcsh > exec zsh
into one command? I have tried with:
> exec tcsh; zsh > exec tcsh; exec zsh
but none of them seem to work. The only one that seems to work is
> exec tcsh & exec zsh
but I am not sure that is doing what I need.
What other ways are there for fully restarting my interactive shell while re-sourcing my non-interactive environment (i.e. as if I was logging in again in
tcsh
and then switching to zsh)More generally, what is the recommended practice for using different shells for interactive and non-interactive work and making sure that the interactive shell starts with the environment from the non-interactive shell? (with the possibility of modifying bits of this environment in the init files of the interactive shell )