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

1 Answer 1

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).

3
  • thanks for your answer. I created ~/.profile but got this error -bash: $'\r': command not found
    – olo
    Nov 7, 2012 at 0:54
  • 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
    Nov 7, 2012 at 1:05
  • dos2unix permission denied. I will try to get this sorted.thanks a lot
    – olo
    Nov 7, 2012 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .