LOOPWHILEX(1)

NAME
loopwhilex - perform a conditional loop

SYNOPSIS
loopwhilex [-n] [-o okcodes | -x breakcodes] prog...

DESCRIPTION
loopwhilex runs prog... as a child process and waits for it to complete.

As long as prog exits zero, loopwhilex runs it again.

loopwhilex then exits with an approximation ( cf. execline-exitcodes(7)) of the last prog invocation's exit code.

‘loopwhilex prog...’ is equivalent to ‘loopwhilex -n -x 0 prog...’ and ‘loopwhilex -o 0 prog...’

Be careful: execline maintains no state, in particular it uses no real variables, and environment will be of no use here since every instance of prog... runs as a separate child process. To avoid being stuck in an infinite loop, prog... should modify some external state - for instance, the filesystem.

OPTIONS

-o okcodes
    okcodes must be a comma-separated list of exit codes. loopwhilex will keep looping as long as prog exits with one of the codes in okcodes.

-x breakcodes
    Like the previous option, but with inverted meaning - the listed exit codes are codes that will break the loop and exit, and the unlisted exit codes will keep the loop running.

-n  Negate the test. This option is now redundant, and may disappear soon.

SEE ALSO
forbacktickx(1), forstdin(1), forx(1), execline-exitcodes(7)

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/loopwhilex.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)