[bug #68122] history is not saved on terminal close

Andrey <[email protected]> Thu, 5 Mar 2026 11:52:31 -0500 (EST)
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/bugs/?68122>

                 Summary: history is not saved on terminal close
                   Group: The GNU Bourne-Again SHell
               Submitter: bam80
               Submitted: Чт 05 мар 2026 16:52:28
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Unlocked


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Чт 05 мар 2026 16:52:28   By: Andrey <bam80>
From the doc:
"When a shell with history enabled exits, bash copies the last $HISTSIZE
entries from the history list to $HISTFILE."

This doesn't happen if bash exits due terminal app close instead of direct
logout from within the shell, which is unexpected and perceived as a bug, as
e.g. the history is lost on reboot.

Workaround:
trap 'history -a' EXIT







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68122>

_______________________________________________
Сообщение отправлено по Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaam0zwAKCRCqLAuaBUf3
TjcaAP0Thh/85Vbq+SScBxhB8ZXHRxa7btdpJiNBZ7dLwB0s/wEAtUVvugoNdPjK
y/27UfoegaQhVtQxIW1PIfiMVC+MAAM=
=GHcN
-----END PGP SIGNATURE-----