News for hackers. Stuff that matters.
Re:Ask HN: Is there a way to make bash history dir specific? by brbsix on Monday May 23, 2016 @08:49PM (#11758172)
Bear in mind I think this is pretty crazy and I haven't tested the following, but something along these lines added to your .bashrc should work:

    set_per_dir_history(){
        history -a  # append new history lines to the existing history file
        history -c  # clear history list in memory
        export HISTFILE=$PWD/.bash_history  # set new history file (uses .bash_history in the current directory)
        history -r  # read the new history file into memory
    }

    export PROMPT_COMMAND="set_per_dir_history;$PROMPT_COMMAND"
Personally I'd add some additional logic to the set_per_dir_history function, defaulting to ~/.bash_history and only whitelisting specific directories.
Re:Ask HN: Is there a way to make bash history dir specific? by andrewfromx on Tuesday May 24, 2016 @01:09PM (#11763337)
i wonder why this isn't default bash history behavior? Wouldn't it be way more useful this way?