aboutsummaryrefslogtreecommitdiff
path: root/man/man1/maybe.1
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-02-12 16:53:20 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-02-12 16:53:20 +1300
commitcd3e8631255561d8ab21352b8cb691c05ca47fcb (patch)
treeb90146674996b1efb79c06203b19a354b7eaacf9 /man/man1/maybe.1
parentUpdate submodules (diff)
downloaddotfiles-cd3e8631255561d8ab21352b8cb691c05ca47fcb.tar.gz
dotfiles-cd3e8631255561d8ab21352b8cb691c05ca47fcb.zip
Add try(1) and maybe(1)
Diffstat (limited to 'man/man1/maybe.1')
-rw-r--r--man/man1/maybe.125
1 files changed, 25 insertions, 0 deletions
diff --git a/man/man1/maybe.1 b/man/man1/maybe.1
new file mode 100644
index 00000000..ebd622b3
--- /dev/null
+++ b/man/man1/maybe.1
@@ -0,0 +1,25 @@
+.TH MAYBE 1 "November 2015" "Manual page for maybe"
+.SH NAME
+.B maybe
+\- possibly exit with success
+.SH USAGE
+.B maybe [-hv] [-d DENOMINATOR]
+.SH DESCRIPTION
+Like true(1) or false(1), but exits with success randomly with a given
+probability. Good for using in tests. Exits with 2 rather than 1 on usage
+errors.
+.P
+This just uses integer division with Bash's special RANDOM variable, so it's
+far from scientific precision.
+.P
+Option -h gives help, option -v turns on verbose output, option -d specifies
+the denominator for the probability; defaults to 2 (i.e. roughly equal chance
+of success or failure).
+.P
+ $ maybe
+ $ maybe -v -d3
+.SH SEE ALSO
+try(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
+