aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
Diffstat (limited to 'man')
-rw-r--r--man/man1/chn.1df47
-rw-r--r--man/man1/maybe.1df2
-rw-r--r--man/man1/try.1df2
3 files changed, 49 insertions, 2 deletions
diff --git a/man/man1/chn.1df b/man/man1/chn.1df
new file mode 100644
index 00000000..576e5425
--- /dev/null
+++ b/man/man1/chn.1df
@@ -0,0 +1,47 @@
+.TH CHN 1df "January 2017" "Manual page for chn"
+.SH NAME
+.B chn
+\- filter standard input through multiple runs of a command
+.SH USAGE
+.B chn
+COUNT
+COMMAND [ARG1...]
+.SH DESCRIPTION
+Run the given command the specified number of times, passing the standard
+output of each run into the standard input of the next.
+.P
+As an example, to quote some text with quo(1df) repeatedly:
+.P
+ $ cat msg
+ Hello!
+ $ chn 2 quo < msg
+ >> Hello!
+ $ chn 5 quo < msg
+ >>>> Hello!
+.P
+Zero is a valid count; in this case the input is passed untouched to output:
+.P
+ $ chn 0 quo < msg
+ Hello!
+.P
+Don't confuse this with simply repeating a command. This happens to work:
+.P
+ $ chn 5 sync
+.P
+But this will not do what you expect:
+.P
+ $ chn 5 echo foo
+.SH CAVEATS
+It's slow.
+.P
+It's not a real pipe. The commands are run successively, not in parallel. That
+means you can't pass one line to it and have it return another line before
+sending EOF, for unbuffered (e.g. linewise) tools.
+.P
+There's almost certainly a better way to do this, fixing one or both of the
+above issues, and possibly even in shell; maybe with curlier file descriptor
+logic to save unneeded open(2) syscalls. I smell `eval` usage on the horizon.
+.SH SEE ALSO
+maybe(1df), try(1df)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/maybe.1df b/man/man1/maybe.1df
index e313eb17..3b89b09d 100644
--- a/man/man1/maybe.1df
+++ b/man/man1/maybe.1df
@@ -22,6 +22,6 @@ of success or failure. rndi(1df) is used for the randomness.
$ maybe 3
$ maybe 2 5
.SH SEE ALSO
-true(1), false(1), try(1df), rndi(1df)
+true(1), false(1), chn(1df), try(1df), rndi(1df)
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/try.1df b/man/man1/try.1df
index d982c1d3..63db5209 100644
--- a/man/man1/try.1df
+++ b/man/man1/try.1df
@@ -17,6 +17,6 @@ run.
$ try maybe
$ try -n5 -s10 gms
.SH SEE ALSO
-maybe(1df)
+maybe(1df), chn(1df)
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>