blob: cc0355208b71f223abf9ffe44fe9a1d0e557bf4a [file] [log] [blame]
Dan Gohman57a6f302007-08-10 15:07:05 +00001#!/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
10set -e
11set -u
12input_lines=$(wc -l)
13if [ "$input_lines" -ne "$1" ]; then
14 echo "count: expected $1 lines and got ${input_lines}."
15 exit 1
16fi
17exit 0