What do those +/- mean if linux job in background finishes (started with &)
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5
--
Chapters
00:00 What Do Those +/- Mean If Linux Job In Background Finishes (Started With &Amp;)
00:44 Accepted Answer Score 73
01:25 Thank you
--
Full question
https://superuser.com/questions/559211/w...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #bash
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5
--
Chapters
00:00 What Do Those +/- Mean If Linux Job In Background Finishes (Started With &Amp;)
00:44 Accepted Answer Score 73
01:25 Thank you
--
Full question
https://superuser.com/questions/559211/w...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #bash
#avk47
ACCEPTED ANSWER
Score 73
From man bash
:
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-
.
That is, the job flagged with a +
is the one that was sent to the background last.
It is also the one that will be brought into the foreground when fg
is used without arguments:
$ /tmp/script &
[1] 9871
$ /tmp/script2 &
[2] 9876
$ /tmp/script3 &
[3] 9881
$ /tmp/script4 &
[4] 9886
$ jobs
[1] Running /tmp/script &
[2] Running /tmp/script2 &
[3]- Running /tmp/script3 &
[4]+ Running /tmp/script4 &
$ fg
/tmp/script4
The job flagged with a -
was sent to the background second last. Other background jobs are not flagged.