mainThe GNU Bourne-Again SHell - Support: sr #110523, Weird behaviour with...

 
 

sr #110523: Weird behaviour with edit-and-execute-command and multiline commands

Submitter:  None
Submitted:  Thu 05 Aug 2021 06:35:23 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 07 Aug 2021 08:06:38 PM UTC, comment #2: 

This bug was forwarded to bug-bash by and responded to there with clarification as to how this feature works.

https://lists.gnu.org/archive/html/bug-bash/2021-08/msg00005.html

Bob Proulx <rwp>
Group Member
Thu 05 Aug 2021 06:46:17 PM UTC, comment #1: 


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


Emanuele Torre <emanuele6>
Thu 05 Aug 2021 06:35:23 PM UTC, original submission:  

Hello.

I think this is actually a bug.

If I type-in a multiline command in an interactive bash shell and then use edit-and-execute-command, that command will get executed, but bash will continue reading for the multiline command.

Example: if i type-in "if true" newline "then echo hi" newline "else echo hello" newline "fi", and then i press \C-x\C-e (to trigger edit-and-execute-command) and exit the editor, "hi" will be printed; then, if then enter "echo hey" newline "echo good morning" and again \C-x\C-e and close the editor, "hi", "hey", and "good morning" get printed.

The behaviour is a bit different (but still probably not intended) with simple commands.

Example: "\" newline "ls /" \C-x\C-e, when i exit the editor the command is executed; then

  • if i type-in "echo hi" and then press enter, "hi" is printed and i get back to the regular bash prompt.
  • if i type-in "echo hi" and then use \C-x\C-e, the editor opens with "ls / echo hi" and if i close it, "ls / echo hi" is run, and then it keeps reading lines for the command; if i use \C-x\C-e, it keeps adding the line as arguments of the command, otherwise if i press enter, it executes the last line as a command and then it stops reading the multiline command and goes back to the regular prompt.


I attached a gif recording of me showing these examples.

Cheers.
 emanuele6

configuration information from bashbug:

Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
uname output: Linux t420 5.10.54-1-lts #1 SMP Wed, 28 Jul 2021 15:05:20 +0000 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #51741:  file.gif added by None (139KiB - image/gif)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rwp (Posted a comment)
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by emanuele6 (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-07 rwp Open/ClosedOpen Closed
    2021-08-07 chet StatusNone Invalid
    2021-08-06 rwp Carbon-CopyRemoved -email is unavailable- -
    2021-08-05 None Attached File- Added file.gif, #51741

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code