From a1fbac8a0adb5b78192aef036458f732787774b5 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Fri, 22 Mar 2019 01:01:32 +0300 Subject: [PATCH] terminal: restore HISTFILE on exit to let bash properly update ~/.bash_history --- plugins/terminal/resources/jediterm-bash.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/terminal/resources/jediterm-bash.in b/plugins/terminal/resources/jediterm-bash.in index 4f619a73d60a..31defa7d2d35 100644 --- a/plugins/terminal/resources/jediterm-bash.in +++ b/plugins/terminal/resources/jediterm-bash.in @@ -70,12 +70,11 @@ function configureCommandHistory { local commandHistoryFile="$__INTELLIJ_COMMAND_HISTFILE__" if [ -n "$commandHistoryFile" ] && [ -z "`trap -p EXIT`" ] then - if [ ! -s "$commandHistoryFile" ] && [ -f "$HISTFILE" ] + trap "history -w \"$commandHistoryFile\"; export HISTFILE=\"$HISTFILE\"" EXIT + if [ -s "$commandHistoryFile" ] then - command cp "$HISTFILE" "$commandHistoryFile" + export HISTFILE="$commandHistoryFile" fi - trap "history -w \"$HISTFILE\"" EXIT - export HISTFILE="$commandHistoryFile" fi } configureCommandHistory