4

I am often running multiple tasks in the background by launching my commands as follows

for ...; task...; done > log 2>&1 &

When my tasks are done, I will receive in the prompt a message with the number corresponding to the order of my various tasks, followed by the mention Done and a reminder of the task launched. What I do not understand is the meaning of an extra mention that is sometime indicated after the number in the form of a + or - sign. I cannot find in the log a mention that a problem occurred. Typical outputs are in the form of

[3] - Done
[4] + Done

Can anyone explain what these + or - signs mean?

1 Answer 1

7

From man bash:

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. 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 -.

1
  • This is notably not specific to bash, all POSIX compliant shells handle job control output this way, so unless you’re using fish, rc, tcsh, or some other exotic shell, this is something you can count on on almost any Linux, BSD, or macOS system. Commented May 29 at 0:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .