Eliminating PID # from background jobs

Tom Lowe lowe at gondor.UUCP
Mon Mar 10 10:55:20 AEST 1986


In article <1093 at bunker.UUCP> wtm at bunker.UUCP (Bill McGarry) writes:
>
>In article <1848> Marc Ries (ries at trwba) wants to run a background
>job from his .profile.  He does NOT want the PID to be printed but
>still wants the standard output of the background job to go to the
>terminal.
>
>Well, there may be other ways to do this but one way would be to
>have a separate shell script call the background job.  For example,
>call this shell script "run_back".  This script would just contain:
>
>	myprog&
>
>Then in your .profile, just run "run_back" (NOTE: Do NOT run this in
>background).
>
>Results?:  "run_back" returns immediately.  No PID # is printed, yet
>"myprog" output will go to the terminal.
>
>				Bill McGarry
>				{decvax, ittatc, philabs}!bunker!wtm

Another methid I do believe will work is the following:
    
      (myprog >& /dev/tty & ) >& /dev/null

the (myprog >& /dev/tty & ) will run the job in the background and
send all output (including std error) to the current tty and the rest
of the line will output what's left (i.e. the PID #) to /dev/null never
to be seen again.


-- 
Tom Lowe
uucp: {allegra, ihnp4}!psuvax1!gondor!lowe
Bitnet:  LOWE at PSUVAXG.BITNET



More information about the Comp.unix.wizards mailing list