From d5a10e6956dfda0b2ff7e70e5d3a8530b22e0c6c Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Sat, 2 Dec 2023 19:32:01 +0800 Subject: [PATCH] cat: -b overrides -n * Option -n is number-all * Option -b is number-some * OpenBSD cat and GNU cat prefer -b if -n and -b are both given --- bin/cat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cat b/bin/cat index 8d9a946d..139f22b3 100755 --- a/bin/cat +++ b/bin/cat @@ -36,7 +36,7 @@ my $ends = exists $options{'e'}; my $tabs = exists $options{'t'}; my $nonprinting = exists $options{'v'} || $ends || $tabs; my $squeeze_empty = exists $options{'s'}; -my $number_lines = exists $options{'n'}; +my $number_lines = $options{'n'} && !$options{'b'}; my $number_non_blanks = exists $options{'b'}; # Unbuffer output for -u.