mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-21 02:59:15 +00:00
232e8feb40
"| grep foo | wc -l | grep 2" idiom used by many tests, so that, for example, tests don't mistakenly accept a count of 12 when 2 is expected. Also, the new form is more consice: "| grep foo | count 2". llvm-svn: 40988
18 lines
325 B
Bash
Executable File
18 lines
325 B
Bash
Executable File
#!/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
|