After running into an issue (I pressed Ctrl+Z instead of Shift +Z in a terminal), I’m currently reading the section of the Bash manual dedicated to background jobs. There’s a sentence there that
I’m not sure I’m interpreting correctly.
7.1 Job Control Basics
……..
Bash waits until it is about to print a prompt before notifying the
user about changes in a job’s status so as to not interrupt any other
output….
For example, I simulated a background task, terminated it using the kill %n command, and noted the terminal output I received:
~$ less .profile &
[1] 38367
~$ jobs
[1]+ Stopped less .profile
~$ kill %1
[1]+ Stopped less .profile --> the job seems still alive
~$ jobs
[1]+ Terminated less .profile --> Did Bash wait until it displayed a prompt to signal this change?
That would be an interesting hypothesis, but I’ve found an example that contradicts that idea: https://www.baeldung.com/linux/job-control-delete-cancel
$ jobs
[1]+ Running sleep 300 & --> "Running" not "stopped": does it matter?
$ kill %1
[1]+ Terminated sleep 300 --> Bash displays the change immediately
My understanding of the Bash manual is probably wrong and I would like to know where is my mistake.