|
Home > Archive > Unix Shell > May 2007 > jobs in jobs; jobs control
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
jobs in jobs; jobs control
|
|
|
| When I did a for loop to start some background jobs
i.e
for ... do
command &
done &
when I type jobs, I can only see the for loop jobs, after the for loop
finishes, I can't see any jobs with the command jobs... I know the
"hidden" jobs are running since they are producing data... how can I
job control them?
Regards
| |
| Michael Tosch 2007-05-23, 7:20 pm |
| Ben wrote:
> When I did a for loop to start some background jobs
> i.e
> for ... do
> command &
> done &
>
> when I type jobs, I can only see the for loop jobs, after the for loop
> finishes, I can't see any jobs with the command jobs... I know the
> "hidden" jobs are running since they are producing data... how can I
> job control them?
>
> Regards
>
run the loop in the foreground:
for ...
do
command &
done
jobs
--
Michael Tosch @ hp : com
| |
| Barry Margolin 2007-05-24, 1:16 am |
| In article <1179897190.132584.60250@u30g2000hsc.googlegroups.com>,
Ben <chinese.central@googlemail.com> wrote:
> When I did a for loop to start some background jobs
> i.e
> for ... do
> command &
> done &
>
> when I type jobs, I can only see the for loop jobs, after the for loop
> finishes, I can't see any jobs with the command jobs... I know the
> "hidden" jobs are running since they are producing data... how can I
> job control them?
A process can only control its child processes, not further descendant
processes. By putting the loop in the background you require a child
for the loop, and as a result all the commands run in grandchild
processes, which your original shell can't control.
If your system has the "pstree" command this is a way to see this
process hierarchy.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
|
|
|
|
|