2

I know that in linux(usually) such initialization file will be .bashrc (bash is the default shell), for OSX it will be .bash_profile. But there are also different shells, like zsh.

So I wonder, if I will have bash as the default shell, with it's configuration in .bashrc, and then I'll decide to run exec zsh - what file would I need to edit to specify the initialization steps for zsh specifically? Are there separate files for different kinds of shells that are running while initialization a new terminal?

I tried to add some aliases before to my .bashrc to achieve the same result:

alias switch_to_zsh="exec zsh; source zsh_config.sh"

But after switching to zsh it forgets about source zsh_config.sh part.

asked Aug 16, 2016 at 20:37
1
  • 2
    Nothing after the exec will be run (if exec succeeds) as exec will replace the existing process with something that has no idea about whatever other commands were in queue with the previous process. Commented Aug 16, 2016 at 20:49

2 Answers 2

3

from zsh manual:

 Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login
 shell, commands are read from /etc/zsh/zprofile and then $ZDOT‐
 DIR/.zprofile. Then, if the shell is interactive, commands are read
 from /etc/zsh/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is
 a login shell, /etc/zsh/zlogin and $ZDOTDIR/.zlogin are read.
answered Aug 16, 2016 at 20:43
1

This page lists the startup files for the most common *nix shells. For zsh the equivalent to .bashrc is .zshrc.

answered Aug 16, 2016 at 20:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.