toys

Tools and things that make my life easier - y'all might like them too

View the Project on GitHub pfuntner/toys

dowhile

Purpose

Runs a command while its output contains (or doesn’t contain) a specified string.

Syntax

Syntax: dowhile [--negate|-v] [--ignorerc] string cmd ...

Options and arguments

| Option | Description | Default | | —— | ———– | ——- | | -v or --negate | Toggles whether the script will require the string is in the output or the string is not in the output. | The default is to run the command while the string is in the output. | | --ignorerc | Toggles whether the script will stop when the command exits with a non-zero status | The default is to exit if the command exit status is non-zero, regardless of the output. |

Example

$ dowhile 10:33 date
2017-11-07 10:33:00.1510068780
Tue Nov  7 10:33:00 EST 2017

2017-11-07 10:33:15.1510068795
Tue Nov  7 10:33:15 EST 2017

2017-11-07 10:33:30.1510068810
Tue Nov  7 10:33:30 EST 2017

2017-11-07 10:33:45.1510068825
Tue Nov  7 10:33:45 EST 2017

2017-11-07 10:34:00.1510068840
Tue Nov  7 10:34:00 EST 2017

$

Notes