-2

When I run a bunch of background jobs with

for s in {1,2,3}; do command_$s &; done;

I can see all of them with the jobs command

$ jobs
[2]    running    command_1
[3]  - running    command_2
[4]  + running    command_3

I know that the first column is the ID (I can for example kill -9 %2 to kill command_)

But what does +, - and lack of any of those means? Running man jobs and jobs -h does not work.

Greg
  • 149
  • 1
  • 1
  • 6

1 Answers1

1

In the Info manual for bash, there is a description in chapter 7.1, Job Control Basics:

Job number n may be referred to as ‘%n’. The symbols ‘%%’ and ‘%+’ refer to the shell’s notion of the current job, which is the last job stopped while it was in the foreground or started in the background. A single ‘%’ (with no accompanying job specification) also refers to the current job. 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 ‘-’.

telcoM
  • 4,448
  • 15
  • 25