Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > gnu.bash.bug > #16766
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: multi-line command history does not work when new terminal opened |
| Date | 2020-08-17 10:09 -0400 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.36.1597673437.2469.bug-bash@gnu.org> (permalink) |
| References | <CAMMw470HN82r8UTcve49HeiYFYt7n1LZxCEU6o59S8Uh9xGTMg@mail.gmail.com> <41e522c2-895f-31b0-91b8-d9f4b1bfe12d@case.edu> |
On 8/16/20 2:39 AM, Hyunho Cho wrote: > Bash Version: 5.0 > Patch Level: 17 > Release Status: release > > #################################################################### > > > I have enabled the shell options for multi-line command history like this > > shopt -s lithist > shopt -s cmdhist > > and it works well in current terminal > > bash$ history > 8651 echo history test 1 > 8652 echo history test 2 > 8653 echo history test 3 > 8654 cat << EOF > 111 > 222 # multi-line command history works well > 333 > EOF > > 8655 history > > ----------------------------------------------------------------------------------- > > if i opened new terminal then the multi-line commands all changed to > single lines like this > > bash$ history > 7819 echo history test 1 > 7820 echo history test 2 > 7821 echo history test 3 > 7822 cat << EOF > 7823 111 # the multi-line > commands changed to single lines > 7824 222 > 7825 333 > 7826 EOF > 7827 history When you enable `lithist', each line of a multi-line command is saved to the history list with a trailing newline, and written to the history file as a separate line. With the traditional readline history file format, that makes each line a separate history entry unless the application uses a delimiter to logically separate commands. With bash, that delimiter is the timestamp that is controlled by HISTTIMEFORMAT. Here are a couple of messages that explain the issue in detail: https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00112.html https://lists.gnu.org/archive/html/bug-bash/2017-06/msg00119.html -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar
Re: multi-line command history does not work when new terminal opened Chet Ramey <chet.ramey@case.edu> - 2020-08-17 10:09 -0400
csiph-web