I have a script written in bash that sets up my zsh config and changes current user's shell to zsh if needed/possible. After default shell is changed, I want zsh to load my new profile, but when I do a regular source, it opens in shell run by script (bash).


I don't find any step in your question, where you actually start the Z shell... so probably you want to include a exec /bin/zsh in your (bash-) script and then zsh will source automatically your zsh config in ~/.zshrc.

Excerpt from bash's man page:

exec [-cl] [-a name] [command [arguments]]

If command is specified, it replaces the shell. No new process is created (...)

  • I rechecked my code and found that I did my exec wrong using ``. Thanks! – Dmitry Gladkov Feb 28 '13 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.