Can a Bourn Shell Script put itself in the background?

Nikos Vassiliadis nvass9573 at gmx.com
Thu Jun 4 14:29:50 UTC 2009


Martin McCormick wrote:
> 	So, can I make a shell script background itself after
> starting?

You could run all your code in a sub-shell:
#!/bin/sh
(
	#your script here
) &

or in a shell function:
old_script()
{
	#your script here
}

old_script $* &

Perhaps the second way requires less code
re-factoring...

Nikos


More information about the freebsd-questions mailing list