From 6ded150f4a01dcd2da6af39a96bc6040d34f3766 Mon Sep 17 00:00:00 2001 From: David Dworken <david@daviddworken.com> Date: Wed, 9 Nov 2022 15:15:08 -0800 Subject: [PATCH] Respect HISTFILE for bash history too --- client/lib/lib.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/lib/lib.go b/client/lib/lib.go index b6cc992..b80d4d1 100644 --- a/client/lib/lib.go +++ b/client/lib/lib.go @@ -622,7 +622,11 @@ func parseFishHistory(homedir string) ([]string, error) { } func parseBashHistory(homedir string) ([]string, error) { - return readFileToArray(filepath.Join(homedir, ".bash_history")) + histfile := os.Getenv("HISTFILE") + if histfile == "" { + histfile = filepath.Join(homedir, ".bash_history") + } + return readFileToArray(histfile) } func readFileToArray(path string) ([]string, error) {