Dan Gohman | 57a6f30 | 2007-08-10 15:07:05 +0000 | [diff] [blame] | 1 | #!/bin/sh |
2 | # | ||||
3 | # Program: count | ||||
4 | # | ||||
5 | # Synopsis: Count the number of lines of input on stdin and test that it | ||||
6 | # matches the specified number. | ||||
7 | # | ||||
8 | # Syntax: count <number> | ||||
9 | |||||
10 | set -e | ||||
11 | set -u | ||||
12 | input_lines=$(wc -l) | ||||
13 | if [ "$input_lines" -ne "$1" ]; then | ||||
14 | echo "count: expected $1 lines and got ${input_lines}." | ||||
15 | exit 1 | ||||
16 | fi | ||||
17 | exit 0 |