redirexec - Execute a command with some file descriptors redirected.



NAME

redirexec - Execute a command with some file descriptors redirected.


SYNOPSIS

redirexec [FILENO:MODE:file:PATH] [--] COMMAND ARGS

redirexec [FILENO:MODE:fd:FILENO] [--] COMMAND ARGS

redirexec [FILENO:-] [--] COMMAND ARGS


DESCRIPTION

Setup redirections before executing COMMAND. You can setup the same type of file and file descriptor redirections as in shell.

FILENO is file descriptor integers or names: "stdin", "stdout", and "stderr" for the stadard file descriptors.

MODE is one of:

r

read

c

create/clobber

rw

read and write

a

append


SHORTHANDS

--STD_FD_NAME-file=PATH
--std[out | err]-append=PATH
--STD_FD_NAME-fd=FILENO
--STD_FD_NAME-close


EXAMPLES

  +-----------------+-------------------------------+
  | shell syntax    | redirexec(1) equivalents      |
  +=================+===============================+
  | > output.txt    | stdout:c:file:output.txt      |
  |                 | 1:c:file:output.txt           |
  |                 | --stdout-file=output.txt      |
  +-----------------+-------------------------------+
  | 2>&1            | stderr:c:fd:stdout            |
  |                 | 2:c:fd:1                      |
  |                 | --stderr-fd=1                 |
  |                 | --stderr-fd=stdout            |
  +-----------------+-------------------------------+
  | < /dev/null     | 0:r:file:/dev/null            |
  |                 | 0:-                           |
  |                 | --stdin-close                 |
  +-----------------+-------------------------------+
  | 10< pwd         | 10:r:file:pwd                 |
  +-----------------+-------------------------------+
  | >/dev/null 2>&1 | 1:- 2:-                       |
  |                 | --stdout-close --stderr-close |
  +-----------------+-------------------------------+


SEE ALSO

redirfd by execlineb(1)

 redirexec - Execute a command with some file descriptors redirected.