+/- after a job in the background is done
They are to distinguish between current and previous job; the last job and the second last job for more than two jobs, with +
for the last and -
for the second last one.
From man bash
:
The previous job may be referenced using
%-
. If there is only a single job,%+
and%-
can both be used to refer to that job. In output pertaining to jobs (e.g., the output of the jobs command), the current job is always flagged with a+
, and the previous job with a-
.
Example:
$ sleep 5 &
[1] 21795
$ sleep 5 &
[2] 21796
$ sleep 5 &
[3] 21797
$ sleep 5 &
[4] 21798
$ jobs
[1] Running sleep 5 &
[2] Running sleep 5 &
[3]- Running sleep 5 &
[4]+ Running sleep 5 &
$
[1] Done sleep 5
[2] Done sleep 5
[3]- Done sleep 5
[4]+ Done sleep 5
I'm guessing you are referring to when you check jobs via $jobs
. However, as you probably know already, n
denotes the job #. The [n] +
denotes the final job that was called.
[n] -
denotes the second to last job that is called.
For example:
chris@chris-VirtualBox:~$ sleep 30 &
[1] 904
chris@chris-VirtualBox:~$ sleep 50 &
[2] 972
chris@chris-VirtualBox:~$ jobs
[1]- Running sleep 30 &
[2]+ Running sleep 50 &
That is why, in this case, our sleep 50 &
is last: [2]+
and sleep 30 &
is second to last: [1]-