summaryrefslogtreecommitdiff
path: root/test/Scripts/count
blob: 1c3d7e0953b2c8fcbdaa7a689d975470023073b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
#
# Program: count
#
# Synopsis: Count the number of lines of input on stdin and test that it
#           matches the specified number.
#
# Syntax:   count <number>

set -e
set -u
input_lines=`wc -l`
if [ "$input_lines" -ne "$1" ]; then
  echo "count: expected $1 lines and got ${input_lines}."
  exit 1
fi
exit 0