From: Jonathan Nieder Date: Tue, 16 Nov 2010 19:23:18 GMT Subject: Re: [PATCH] t6022: Use -eq not = to test output of wc -l Message-ID: <20101116192318.GA15828@burratino> In-Reply-To: <7vtyjhgk3z.fsf@alter.siamese.dyndns.org> Junio C Hamano wrote: > Jonathan Nieder writes: >> + if test "$3" = - >> + then >> + line_count_tmp=test_line_count.output >> + cat >"$line_count_tmp" >> + set -- "$1" "$2" "$line_count_tmp" >> + fi >> + if ! test $(wc -l <"$3") "$1" "$2" >> then >> echo "test_line_count: line count for $3 !$1 $2" >> cat "$3" >> return 1 > > You forgot to clean the temporary file here. The idea was to leave it around to help in diagnosis. But you are right, it is more useful to not break later tests: rm -f "$line_count_tmp" return 1 > Also if the file is huge, do we really want to cat the whole thing? I think so. (Maybe not if it is binary, though.)