NOTE: Please see my second edit below for an update on the problem.
Cygwin was working fine for me until last week. Now .bashrc isn't getting sourced. I must have installed something or changed something but I can't remember exactly what caused the problem. When I start Cygwin, I'm in my Windows home and none of my aliases work. I have to manually source .bashrc. The following is my Cygwin.bat:
@echo off
C:
chdir C:\cygwin\bin
set CYGWIN=tty notitle glob
bash --login -i
Any ideas?
EDIT: My .bash_profile contains the following,
# source the users bashrc if it exists
if [ -f "${HOME}/.bashrc" ] ; then
source "${HOME}/.bashrc"
fi
EDIT2: IMPORTANT! When I started Cygwin it starts in my Windows home folder. I tried putting my .bash_profile and .bashrc in this folder and they were sourced correctly! This means that the problem has been reduced to figuring out why Cygwin starts in the Windows home folder and not the normal Cygwin home folder.
EDIT3: Results of running grep Gulshan /etc/passwd/
$ grep Gulshan /etc/passwd
Administrator:unused:500:513:U-Gulshan-HP\Administrator,S-1-5-21-1235613160-4193452482-2032876723-500:/home/Administrator:/bin/bash
Guest:unused:501:513:U-Gulshan-HP\Guest,S-1-5-21-1235613160-4193452482-2032876723-501:/home/Guest:/bin/bash
Gulshan:unused:1000:513:U-Gulshan-HP\Gulshan,S-1-5-21-1235613160-4193452482-2032876723-1000:/home/Gulshan:/bin/bash
Best Answer
The Cygwin FAQ explains how
$HOME
is set:My best guess is that you've messed up your
/etc/passwd
file. (The Windows home directory is%USERPROFILE%
, not%HOME%
.)What does
grep USERNAME /etc/passwd
print (replacingUSERNAME
with your user name)?