Re: Question on background jobs
- From: "Joachim Schmitz" <nospam.jojo@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 25 Jun 2008 11:30:55 +0200
Joachim Schmitz wrote:
Barry Margolin wrote:After being hinted about that switch by Bill Marcum...
In articleI just did (see the thread about "Running a command for a limited
<71394f16-cdc8-4d97-998f-216c58ac9e19@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
bsh <brian_hiles@xxxxxxxxxxxxxx> wrote:
On Jun 24, 12:54 pm, Chad <cdal...@xxxxxxxxx> wrote:
Then how come you can't have job control in a non-interactive shell
(via a script)
It does. Investigate [in at least ksh(1)] the monitor shell option:
set -o monitor
From the ksh(1) manpage:
If the monitor option of the set command is turned on, an
interactive shell
associates a job with each pipeline. It keeps a table of current
jobs, printed
by the jobs command, and assigns them small integer numbers. When a
job is started asynchronously with &, the shell prints [a line
associating
that command with a job number].
That description says that the option affects interactive shells, his
question was about non-interactive shells.
Note that ksh and bash (and probably other shells) have a -i option
to make it interactive even if it's executing a script. So if you
really wanted to have job control enabled in a script, you could
start it with:
#!/bin/ksh -i
I've never tried this so I'm not sure how it would affect things.
time". "set -m" is switching on job control for non-interactive shells
#!/bin/ksh -m
Bye, Jojo
.
- References:
- Question on background jobs
- From: Chad
- Re: Question on background jobs
- From: Chad
- Re: Question on background jobs
- From: Barry Margolin
- Re: Question on background jobs
- From: Chad
- Re: Question on background jobs
- From: bsh
- Re: Question on background jobs
- From: Barry Margolin
- Re: Question on background jobs
- From: Joachim Schmitz
- Question on background jobs
- Prev by Date: Re: help me in writing shell script
- Next by Date: Re: in-place editing in awk
- Previous by thread: Re: Question on background jobs
- Next by thread: Re: Question on background jobs
- Index(es):
Relevant Pages
|