How to force Cygwin's .bash_history to be in custom HOME?

1

I am using Cygwin (CYGWIN_NT-6.3 2.0.4(0.287/5/3)) with a custom /etc/profile which I use to set the HOME to a personalized path, also, /etc/passwd sets that same path for the [only] user.

If I load bash.exe (with or without -l), input a few commands and exit, a .bash_history file is created/updated in the directory that Windows regards as the HOME folder for the user, not in the directory set with /etc/profile.

Tilde resolves to the path set on /etc/profile. It seems that only .bash_history is "misbehaving".

Which of Cygwin's configuration files should I change to force bash.exe to save .bash_history inside the directory set on /etc/profile as HOME?

Anderson Nascimento Nunes

Posted 2015-07-17T13:11:13.283

Reputation: 506

Answers

2

It seems that you set the custom value for HOME after HISTFILE has already been set. When you set the value of HOME in your modified /etc/profile, you should then set:

HISTFILE=$HOME/.bash_history

Anthony Geoghegan

Posted 2015-07-17T13:11:13.283

Reputation: 3 095