doc: avoid redundant use of cat

The update-hook-example.txt script uses this anti-pattern twice. Call grep with the input file name directy. While at it, merge the two consecutive grep calls. Signed-off-by: Beat Bolli <dev+git@drbeat.li> Acked-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Beat Bolli committed Mar 15, 2024 at 20:45 UTC 938e891a9aa6626a948bb507f2f6b215be5bb6a3
1 file changed +2 -2
Documentation/howto/update-hook-example.txt
+2 -2
@@ -100,7 +100,7 @@ info "The user is: '$username'"
100
101 if test -f "$allowed_users_file"
102 then
103 - rc=$(cat $allowed_users_file | grep -v '^#' | grep -v '^$' |
103 + rc=$(grep -Ev '^(#|$)' $allowed_users_file |
104 while read heads user_patterns
105 do
106 # does this rule apply to us?
@@ -138,7 +138,7 @@ info "'$groups'"
138
139 if test -f "$allowed_groups_file"
140 then
141 - rc=$(cat $allowed_groups_file | grep -v '^#' | grep -v '^$' |
141 + rc=$(grep -Ev '^(#|$)' $allowed_groups_file |
142 while read heads group_patterns
143 do
144 # does this rule apply to us?