Reputation: 4429
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!
Upvotes: 18
Views: 18814
Reputation: 11926
~/.bash_profile
is executed before the initial command prompt is returned to the user. After that, every time a new shell is opened, ~/.bashrc
is executed.
Adding . ~/.bashrc
at end of ~/.bash_profile
has resolved the problem.
Now you can check existing aliases using alias
command.
Find more details on github.
Upvotes: 1
Reputation: 1263
On my version of cygwin I found that only ~/.profile
was being execueted so added
if [ -e "${HOME}/.bash_profile" ]; then
source "${HOME}/.bash_profile"
fi
to the .profile
file. My .bash_profile
file contains another test for .bashrc
and executes that from inside there. I also added the following two lines to my .bashrc
file.
export BASH_ENV="${HOME}/.profile"
export ENV="${HOME}/.profile"
The first of these ensures that .profile
gets executed in non-interactive terminals and the second ensures it gets executed in POSIX terminals. I found a very useful explanation of what get run and when in the Bash Reference Manual.
In your case it wouldn't help as you have an issue with the value of your HOME
environment variable but this page comes up quite high on the list when searching for this issue.
Upvotes: 5
Reputation: 4429
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
Upvotes: 15
Reputation: 3010
You can also also set BASH_ENV variable, e.g., BASH_ENV='C:\DOCUME~1\dwyttenb\.bashrc'
Upvotes: 3