bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cmdhist + multi-line command : empty lines do not get semicolon correctl


From: Joakim Lindblad
Subject: cmdhist + multi-line command : empty lines do not get semicolon correctly => wrong history
Date: Sat, 15 Jan 2022 00:42:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -O2 -pipe -march=native -fomit-frame-pointer
uname output: Linux ryzen 5.10.52-gentoo #1 SMP Sat Aug 21 22:58:34 CEST 2021 
x86_64 AMD Ryzen 9 3900X 12-Core Processor AuthenticAMD GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.1
Patch Level: 16
Release Status: release


Description:
      Using the default `shopt -s cmdhist; shopt -u lithist`,
      multi-line commands which include completely empty lines (e.g. copied 
from a spaciously formatted script)
      do not get the appropriate semicolons. Thus, the command being stored in 
the history is wrong!

      The problem exists for all multi-line commands, including  if, for, while

      Note: The problem does not appear if using `shopt -s lithist`

Repeat-By:
      Starting from a clean and freshly compiled bash
      Note the empty line before the 2nd `echo`(just hitting return twice)


~/bash-5.1.16 $ ./bash --noprofile --norc
bash-5.1$ if true; then echo A

echo B; fi
A
B
bash-5.1$ !!
if true; then echo A echo B; fi
A echo B


Expected behaviour:

bash-5.1$ !!
if true; then echo A; echo B; fi
A
B









När du har kontakt med oss på Uppsala universitet med e-post så innebär det att 
vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du 
läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For 
more information on how this is performed, please read here: 
http://www.uu.se/en/about-uu/data-protection-policy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]