aboutsummaryrefslogtreecommitdiff
path: root/man/man1/maybe.1
blob: 9fd90c8b507ce912b6b12c1aa9e408218c0a6806 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.TH MAYBE 1 "February 2016" "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
true(1), false(1), try(1)
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>