Search code examples
cygwin

Defining aliases in Cygwin under Windows


I am trying to define some aliases in cygwin, but with no success. I am doing so like this at the end of the .bashrc file.

alias foo='pwd'

I have tried to add this line in a .bashrc file in both inside the home folder of cygwin and in the home folder for the Windows user I am on C:\Users\Nuno\. In both cases I have just appended this line to a copy of the /etc/skel/.bashrc file. In either cases, it didn't work.

I had this working before. I had to reinstall Cygwin and ever since it never worked properly again. I have removed all files (or at least think so, when doing the reinstallation). I have also noticed that in the first install (when it was working) cygwin already was creating .bash files in the home folder. Now, it doesn't.

I am on a machine running Windows 7.

EDIT: My cygwin home folder is set to the Windows home folder C:\Users\Nuno\. I have placed what I think is a valid .bashrc file there, but it still doesn't work.

Thanks in advance.


Solution

  • As me_and already explained what's going on I just want to add a workaround should you for whatever reason not be able or willing to remove Windows' HOME environment variable.

    Normally the shortcut for Cygwin executes

    C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -
    

    Instead you can create a batchfile with the following content and start that:

    @echo off
    set HOME=
    start C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -
    

    That will start a a Cygwin windows whose home directory settings are not overridden by a Windows environment variable.