| redirexec - Execute a command with some file descriptors redirected. |
redirexec - Execute a command with some file descriptors redirected.
redirexec [FILENO:MODE:file:PATH] [--] COMMAND ARGS
redirexec [FILENO:MODE:fd:FILENO] [--] COMMAND ARGS
redirexec [FILENO:-] [--] COMMAND ARGS
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:
read
create/clobber
read and write
append
+-----------------+-------------------------------+ | 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 | +-----------------+-------------------------------+
redirfd by execlineb(1)