[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `jobs` shows output even when nothing has been started in the backgr
From: |
Chet Ramey |
Subject: |
Re: `jobs` shows output even when nothing has been started in the background |
Date: |
Wed, 14 Jun 2023 10:47:13 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 |
On 6/14/23 4:47 AM, Ajeet D'Souza wrote:
Bash Version: 5.2
Patch Level: 15
Release Status: release
*Description:*
I apologize if this is not a bug, but I couldn't find any documentation
around this behaviour.
In Bash, this does not produce any output:
/bin/echo; jobs -l
But if you run it in a subshell, it does:
(/bin/echo; jobs -l) # output: [1] 42135 Done /bin/echo
Similar problem if you put this into $PROMPT_COMMAND, although it does not
run in a subshell AFAIK:
PROMPT_COMMAND='/bin/echo; jobs -l' # output on every prompt: [1] 42135
Done /bin/echo
This happens only for external processes, if you were to use the builtin
echo, it would not show any background process.
Thanks for the report. I changed this back in late September, 2022 after
a bug-bash discussion:
https://lists.gnu.org/archive/html/bug-bash/2022-09/msg00067.html
The original report was
https://lists.gnu.org/archive/html/bug-bash/2022-07/msg00117.html
The original (through bash-5.2) behavior was due to the subshell not
notifying the user about the status of the completed foreground job,
even though not running it in a subshell ignored foreground jobs. The
fix was to remove terminated foreground jobs the shell would never notify
the user about (foreground jobs not killed by a signal) from the jobs list.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/