execline
Software
skarnet.org
The loopwhilex program
loopwhilex performs a conditional loop.
Interface
loopwhilex [ -n ] [ -x exitcodes ] prog...
- loopwhilex runs prog... as a child process and
waits for it to complete.
- As long as prog exits zero, loopwhile runs it again.
- loopwhilex then exits 0. If prog was killed by a signal,
loopwhilex exits that signal's number instead.
Options
- -x exitcodes : exitcodes must be a comma-separated
list of valid exit codes. If this option is given, loopwhilex will exit if prog...'s
exit code is listed in breakcodes.
- -n : negate the test: run prog... as long as it exits non-zero
(or exits a code that is not listed in breakcodes).
Notes
- loopwhilex prog... is equivalent to loopwhilex -n -x 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.