22.3.4 Executing programs in background

Function: mbfl_program_execbg INFD OUFD PROGRAM
Function: mbfl_program_execbg INFD OUFD PROGRAM ARG

Like mbfl_program_exec(), but runs the given command line as:

PROGRAM ARG ... <&INFD >&OUFD &

additionally: set the global variable mbfl_program_BGPID to the process ID of the background process; that is: mbfl_program_BGPID is the value of $! right after the process execution.

If the redirection of stderr to stdout is requested with mbfl_program_redirect_stderr_to_stdout(): such request is honoured and consumed. For a discussion of channels redirection when calling this function, see Redirecting channels when executing a program.

Function: mbfl_program_execbg2 INFD OUFD ERFD PROGRAM
Function: mbfl_program_execbg2 INFD OUFD ERFD PROGRAM ARG

Like mbfl_program_execbg(), but redirects also the standard error of the executed process to ERFD, which must be a numeric file descriptor.

If the redirection of stderr to stdout is requested with mbfl_program_redirect_stderr_to_stdout(): such request is ignored and consumed. For a discussion of channels redirection when calling this function, see Redirecting channels when executing a program.

Variable: mbfl_program_BGPID

Used by mbfl_program_execbg() to store the process id of the program executed in background.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.