[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
for loop goes to stopped job when Ctrl+C is pressed
From: |
ks1322 ks1322 |
Subject: |
for loop goes to stopped job when Ctrl+C is pressed |
Date: |
Sat, 17 Dec 2022 23:59:28 +0300 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -flto=auto -ffat-lto-objects -fexceptions -g
-grecord-gcc-switches -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-prote>
uname output: Linux yourdomain.com 6.0.12-300.fc37.x86_64 #1 SMP
PREEMPT_DYNAMIC Thu Dec 8 16:58:47 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
Bash Version: 5.2
Patch Level: 9
Release Status: release
Description:
When for loop output is piped to less and Ctrl+C is pressed, bash creates
unexpected stopped job
Repeat-By:
1. Create a log file with the command:
yes | head -n 1000000 > log
2. Pipe log output to less this way:
for i in log; do cat $i; done | less
3. Press Ctrl+C in less
4. Quit from less with q
Result:
unexpected stopped job is created
[1]+ Stopped for i in log;
do
cat $i;
done | less
There is no such issue in zsh
- for loop goes to stopped job when Ctrl+C is pressed,
ks1322 ks1322 <=