cygwin doesn't pick up HOME .bashrc

0

I just installed cygwin and everything is pretty good but, cygwin doesn't pick up .bashrc file.

vi ~/.bashrc
alias ls='ls -la --color'

after reopened a new cygwin terminal, the content is still there, but alias doesn't work. If I run alias ls='ls -la --color' in the terminal, alias works but it doesn't save to .bashrc file.

I am sure I am in the user home directory cd ~

someone could give me a hint? Thanks a lot

olo

Posted 2012-11-07T00:38:28.820

Reputation: 113

Answers

3

Probably, bash is being launched as a login shell. Login shells do not automatically use the content of .bashrc. If you want them to do so, you can create the file ~/.profile with this content:

[ -f $HOME/.bashrc ] && source $HOME/.bashrc

(as was mentioned in answers to this question, although they were not relevant to that case).

pino42

Posted 2012-11-07T00:38:28.820

Reputation: 256

thanks for your answer. I created ~/.profile but got this error -bash: $'\r': command not found – olo – 2012-11-07T00:54:36.917

1

That is because your editor used Windows line endings (CR+LF, or \r\n) instead of Unix line ending (LF, or \n, only). You can read more about it here, for example. You can probably solve the problem by running the dos2unix .profile command.

– pino42 – 2012-11-07T01:05:20.830

dos2unix permission denied. I will try to get this sorted.thanks a lot – olo – 2012-11-07T01:28:21.773