Enables commands that assume the standard input and output to read and write to files specified in the command line.
Have you ever had trouble with interference between command-invoking command and redirect?
For example, a command line:
sh
ls *.txt | xargs -I {} head -n 3 {} > {}-head.out
does NOT create *-head.out
file for each of the *.txt
files but creates one file {}-head.out
containing outputs of all head
command executions.
The command o-o
is here to help!
You can now run as follows:
sh
ls *.txt | xargs -I {} o-o - {}-head.out - head -3 {}
The o-o
arguments are the standard input, standard output, and standard error output of the child process, and the subsequent arguments are the command line to start the child process.
If you specify -
as the file name for standard input, etc., it will not be redirected. Putting +
in front of a file name will open the file in append mode.
``` Redirect subprocess's standard i/o's.
Usage:
o-o [options]
Options:
-
for no redirection.
-
for no redirection. =
for the same file as the standard input.
-
for no redirection. =
for the same file as the standard output.
Adding +
before a file name means appending to the file (like >>
in redirects).
-e VAR=VALUE Environment variables.
--pipe=STR, -p STR Use the string for connecting sub-processes by pipe (that is, |
).
--force-overwrite, -F Overwrite the file even when exit status != 0. Valid only when =
.
--working-directory=DIR, -d DIR Working directory.
```
To build, use cargo build --release
, which will create the executable target/release/o-o
.
To install, copy a file o-o
in any directory on PATH, e.g. ~/bin
.
To uninstall, remove the file o-o
.
Unlicense (Public Domain).
--force-overwrite
.