bug-bash
[Top][All Lists]
Advanced

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

shell-expand-line working strangely without shebangs


From: Jae Juang
Subject: shell-expand-line working strangely without shebangs
Date: Mon, 05 Aug 2024 16:57:11 +0800

Configuration Information [Automatically generated, do not change]:
Machine: aarch64
OS: linux-gnu 
Compiler: gcc
Compilation CFLAGS: -g -O2
uname output: Linux nixos 6.1.77 #1-NixOS SMP Mon Feb  5 20:13:03 UTC 2024 
aarch64 GNU/Linux
Machine Type: aarch64-unknown-linux-gnu

Bash Version: 5.2
Patch Level: 15
Release Status: release 



Description:
In bash, the very useful shell-expand-line (`M-C-e`) expands command 
substitutions to their contents, on the current line. However, this works very 
strangely for commands without shebangs. Symptoms further described in 
"Repeat-By" section.

Replicated on kitty and mac Terminal on NixOS and macOS with 5.2.15(1)-release 
(built by Nix). Replicated on kitty and mac Terminal on macOS with 
5.2.32(1)-release (built from source).

Does NOT replicate on kitty and mac Terminal on macOS with 3.2.57(1)-release 
(provided by macOS 14.4.1 (23E224)` (Sonoma)).

Previously posted on 
https://unix.stackexchange.com/questions/781355/shell-expand-line-and-shebangs



Repeat-By:
 1. Create a simple executable file with and without shebang.
echo echo hi >> test-no-shebang
chmod +x test-no-shebang
echo '#!/bin/sh' >> test-shebang
echo echo hi >> test-shebang
chmod +x test-shebang

 2. Enter $(./test-shebang), then M-C-e. This works as expected, expanding the 
line to "hi". C-_ works normally, undoing the expansion.

 3. Enter $(./test-no-shebang), then M-C-e. This works strangely, indeed 
expanding the line to "hi", but removing the prompt in front of the line. C-_ 
does not work, printing the character literally instead, and nor do most 
bindings, but C-u kind of works, successfully clearing the line (but not 
clearing the "hi").



reply via email to

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