Re: [PATCH] t0021: expect more variations in the output of uniq -c
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Nov 6, 2016, 21:40 UTC
- Message-ID
- <c842e0a7-b032-e0c4-0995-f11d93c17c0a@kdbg.org>
- In-Reply-To
- <0B7DE8F1-34DF-4271-8936-B9B596EF5F9E@gmail.com>
Am 06.11.2016 um 16:31 schrieb Lars Schneider:
> This looks good to me. I wonder if I should post a patch > to add the "|| return" trick to the following function > "test_cmp_exclude_clean", too?!
The function does this:
for FILE in "$expect" "$actual"
do
grep -v "IN: clean" "$FILE" >"$FILE.tmp" &&
mv "$FILE.tmp" "$FILE"
done &&It is an interesting case: If only matching lines are in the file, nothing would be printed, and grep returns failure. But we shouldn't care, because, strictly speaking, the function only wants to remove lines with a certain pattern. Here, it actually hurts to &&-chain grep!
It wouldn't hurt to write 'mv ... || return', but at the same time, && after grep should be removed.
-- Hannes