On Fri, Oct 01, 2021 at 09:30:04AM -0500, Jesse Hathaway wrote:
> On Fri, Oct 1, 2021 at 8:22 AM Greg Wooledge <greg@wooledge.org> wrote:
> > I think you're looking for this:
> >
> > checkjobs
> > If set, bash lists the status of any stopped and running
> > jobs before exiting an interactive shell. If any jobs
> > are running, this causes the exit to be deferred until a
> > second exit is attempted without an intervening command
> > (see JOB CONTROL above). The shell always postpones ex‐
> > iting if any jobs are stopped.
>
> This doesn't seem to work for me, what am I doing wrong?
>
> $ INPUTRC=/dev/null bash --norc
> bash-5.1$ shopt -s checkjobs
> bash-5.1$ sleep 30 &
> [1] 461671
> bash-5.1$ jobs
> [1]+ Running sleep 30 &
> bash-5.1$ exit
> exit
I don't know. It works here.
unicorn:~$ shopt -s checkjobs
unicorn:~$ sleep 33 &
[1] 537164
unicorn:~$ exit
exit
There are running jobs.
[1]+ Running sleep 33 &
unicorn:~$