LOOPTEST(1)

NAME
looptest - loop iteration tester

SYNOPSIS
looptest count file

DESCRIPTION
The looptest utility counts the number of lines in the specified file and compares it with the specified count. It exits with an appropriate status according to whether this comparison is equal or not equal.

Notice that this utility has the same effect as doing a:

    wc -l <file | tr -d ' \t' | grep '^count$' >/dev/null

In fact, it is a direct replacement for this command line that provides a simpler, more efficient way for both etsh(1) and tsh(1) to perform count-controlled loops.

EXIT STATUS
The looptest utility exits with one of the following values:

0   The file line count is equal to count.

1   The file line count is not equal to count.

2   An error was detected.

EXAMPLES
Each of the following command files causes the shell to perform a loop that prints 80 dots to the standard output.

	: Print dots with etsh and tsh.
	( : ) >prdots.$$
	: Loop
		echo -n .
		echo >>prdots.$$
		if ! { looptest 80 prdots.$$ } goto Loop
	echo ; rm -f prdots.$$

Etsh also offers another way to test the looptest exit status with the `$?' special parameter as illustrated below.

	: Print dots with etsh.
	( : ) >prdots.$$
	: Loop
		echo -n .
		echo >>prdots.$$
		looptest 80 prdots.$$
		if $? -ne 0 goto Loop
	echo ; rm -f prdots.$$

SEE ALSO
etsh(1), tsh(1)

Looptest home page: http://v6shell.org/looptest/

AUTHOR
This implementation of looptest is written by Jeffrey Allen Neitzel.

LICENSE
See http://v6shell.org/looptest/LICENSE for full details.

COPYRIGHT
Copyright (c) 2008-2018
	Jeffrey Allen Neitzel.  All rights reserved.