From cd3e8631255561d8ab21352b8cb691c05ca47fcb Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 12 Feb 2016 16:53:20 +1300 Subject: Add try(1) and maybe(1) --- man/man1/maybe.1 | 25 +++++++++++++++++++++++++ man/man1/try.1 | 21 +++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 man/man1/maybe.1 create mode 100644 man/man1/try.1 (limited to 'man') 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 + diff --git a/man/man1/try.1 b/man/man1/try.1 new file mode 100644 index 00000000..b21e69c3 --- /dev/null +++ b/man/man1/try.1 @@ -0,0 +1,21 @@ +.TH TRY 1 "November 2015" "Manual page for try" +.SH NAME +.B try +\- attempt a command up to a certain number of times until it succeeds +.SH USAGE +.B try [-hv] [-n ATTEMPTS] [--] COMMAND...' +.SH DESCRIPTION +Runs the given command up to a fixed number of times until it exits zero. If +all attempts fail, writes buffered error output from all attempts to stderr. +.P +Option -h gives help, option -v turns on verbose output, option -n specifies +the number of attempts; defaults to 3. Options may be terminated with --. The +remaining arguments are the command to run. +.P + $ try getmails + $ try -v -n3 maybe +.SH SEE ALSO +maybe(1) +.SH AUTHOR +Tom Ryder + -- cgit v1.2.3