hello Alex, The following should do the trick without extending wc functionality:
SOME_COMMANDS | test "$(wc -l)" = YOUR_NUMBER Proof of concept: ### { for n in {1..17}; do echo "$n"; done | test "$(wc -l)" = 17; } && echo ZERO || echo NONZERO ZERO ### { for n in {1..17}; do echo "$n"; done | test "$(wc -l)" = 18; } && echo ZERO || echo NONZERO NONZERO Have a nice day! Michael. On 10/7/20, A B <alexanderashleybo...@gmail.com> wrote: > I mean if you want to get picky about it and have this work exactly like > grep -q, then you need to make the flag accept a threshold value, which it > should match or exceed. > So maybe: wc -l -q3 > > That doesn’t have the same intuitive feel to me, but it wouldn’t violate the > notion of how exit codes should be used either. > > -Alex Boese -- Michael V. Antosha