Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cygwin shell doesn't execute .bashrc

Tags:

shell

cygwin

After start the cygwin shell, it just locate in a wrong home dir:

[email protected] ~
$ pwd
/cygdrive/c/Users/xfire

But it used to be /home/xfire

[email protected] /etc
$ cat passwd | grep xfire
xfire:unused:22773:10513:U-CORP\xfire,S-1-5-21-527237240-725345543-682003330-12773:/home/xfire:/bin/bash

And the .bashrc in the /home/xfire was not executed, even I copy it to the /cygdrive/c/Users/xfire, it also doesn't work!

like image 478
Evans Y. Avatar asked Mar 22 '12 03:03

Evans Y.


People also ask

Where is bashrc in Cygwin?

bashrc files from the /etc/skel folder to get you started. bash: cd: /etc/skel: No such file or directory -> Turns out, you have to run cygpath -w /etc/skel as administrator.

How do I run a .bashrc file?

bashrc File from the beginning, you can do so by pressing Ctrl+Alt+T or opening a new terminal tab, making it all more accessible. At each launch, Bash runs the contents of the . bashrc file to load your preferences. You can find this shell script in the home directory of users.

How do I run .bashrc on Windows?

Just type notepad ~/. bashrc from the bash prompt and notepad will be launched with this file opened or will ask to create it, if it doesn't exist. If you're comfortable to vim, just type vim ~/. bashrc .


2 Answers

On cygwin, I add this to my ~/.bash_profile:

. ~/.bashrc
like image 110
glenn jackman Avatar answered Oct 22 '22 23:10

glenn jackman


Some program add an "HOME" environment in windows registry and set the value to "C:\Users\xfire", that's why cygwin take that directory as the home. cygwin.com/faq-nochunks.html

like image 25
Evans Y. Avatar answered Oct 23 '22 00:10

Evans Y.