Date: Thu, 4 Jun 2009 15:42:21 +0100 From: "Barry Byrne" <barry.byrne@wbtsystems.com> To: "'Martin McCormick'" <martin@dc.cis.okstate.edu>, <freebsd-questions@freebsd.org> Subject: RE: Can a Bourn Shell Script put itself in the background? Message-ID: <C96FA0139A334A87B8432652524189DB@wbt.wbtsystems.com> In-Reply-To: <200906041406.n54E6Fts006668@dc.cis.okstate.edu> References: <200906041406.n54E6Fts006668@dc.cis.okstate.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> From: owner-freebsd-questions@freebsd.org > [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of > Martin McCormick > I tried > > bg $$ > > but $$ is the current process invoked just as $! is the process > of a backgrounded process started by that shell. > > So, can I make a shell script background itself after > starting? > > Right now, I remind my coworkers to append the & after the > script name. the bg command expects a job number, not a process > ID. Martin, If you mean you'd like to be able to put a script that is already running into the background, then you could press CTRL-Z to suspend the process. Then running 'jobs' will list the job id. Then 'bg jobnumber' (probably 1) should put it into the background. Cheers, Barry
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C96FA0139A334A87B8432652524189DB>