MSYS: alias resets upon restarting MSYS console

0

Every time I reopen the MSYS console (not cmd.exe) I find that the aliases that I have added to the shell are cleared. How can I save my aliases so that I do not to reenter them on every use?

For example:

$ alias desktop="cd=C:/Users/Superuser/Desktop"
$ alias
clear='clsb'
desktop='cd=C:/Users/Superuser/Desktop'

Upon restarting:

$ alias
clear='clsb'

How can I preserve my aliases?

snmcdonald

Posted 2010-05-28T20:07:52.430

Reputation: 247

Answers

1

Change to user directory:

cd ~

Append to .bash_profile (which will run upon every new bash session):

echo "alias desktop=\"cd=C:/Users/Superuser/Desktop\"" >> .bash_profile

Warning! Some versions of msys uses .profile for aliases.

snmcdonald

Posted 2010-05-28T20:07:52.430

Reputation: 247

2

I don't know about the MSYS console, but doing the following works in minTTy.

Open your ~/.bash_profile (or ~/.profile) file in a good text editor. Scroll to the bottom. After the line alias clear=clsb, add

source ~/.bash_aliases

This way, you get to keep your aliases in a separate file while still having them load every time you start your Console or terminal emulator.

SilversleevesX

Posted 2010-05-28T20:07:52.430

Reputation: 89