Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm switching to Cygwin from the bash shell that ships with Git for Windows, and for some strange reason the .bashrc file is not being sourced when I open a new Terminal. I have to

source .bashrc

manually just to get my normal settings. echo $0 $- returns -bash himBH

What could be the problem?

share|improve this question
1  
Need this output: echo $0 $- –  Mikel Aug 3 '12 at 17:21
    
@Mikel: added to question; thanks. –  iconoclast Aug 3 '12 at 17:26

1 Answer 1

The minus at the start of $0 means that bash is being started as a login shell.

In this case, bash reads initialization commands from .bash_profile, not .bashrc.

The simplest fix is to create ~/.bash_profile if it doesn't already exist, and put

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

at the top.

See also: What's the conf file reading between login and non-login shell?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.