Bash alias doesn't work in cygwin

2.3k Views Asked by At

Can someone please explain to me how to set up bash aliases? I am using cygwin on windows 8.

I added alias my_first_alias='git status' at the end of /.bashrc file. Typing my_first_alias into cygwin results in -bash: my_first_alias: command not found.

Trying to restart cygwin, running . .bashrc doesn't help with that.

1

There are 1 best solutions below

1
On BEST ANSWER

The syntax of your alias command is correct and should be working as long as the alias command is actually being executed. It sounds like your .bashrc file is not being loaded when you start your bash shell. Make sure you have the following in your ~/.bash_profile file:

[[ -s ~/.bashrc ]] && source ~/.bashrc

Also make sure that the location of .bashrc and .bash_profile are in your home directory. Above you have referenced /.bashrc. I doubt "/" is your home directory. You can determine the location of your home directory from the shell by entering the command:

cd; pwd