Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you export your .bashrc to .zshrc?

Tags:

bash

zsh

zshrc

I am trying to move to zsh from Bash.

I put my .bashrc directly to my .zshrc, and it caused a lot of errors when I try to use Bash again.

How can you export your .bashrc to .zshrc?

like image 448
Léo Léopold Hertz 준영 Avatar asked Apr 19 '09 01:04

Léo Léopold Hertz 준영


People also ask

Do I need to copy bashrc to Zshrc?

bashrc is a file that runs bash commands. . zshrc is a file that runs zsh commands. You can't expect zsh to be able to run the bash commands in your . bashrc , so you should convert it into a new .

What is a ~/ Zshrc?

it means: >> is append to. ~ is file located in current user's home directory. .


1 Answers

While lhunath's answer pushed me in the right direction, zsh does not seem to source .profile automatically. Lot's of good info on this topic can be found on this superuser post.

The adaption I'm using is putting common aliases and functions in .profile and manually sourcing them as follows:

In ~/.bashrc:

source ~/.profile 

In ~/.zshrc:

[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile' 

emulate is a zsh builtin command. With single argument set up zsh options to emulate the specified shell as much as possible.

like image 157
Ryne Everett Avatar answered Oct 06 '22 13:10

Ryne Everett