Re: [PATCH 01/22] doc: avoid redundant use of cat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Beat Bolli" <bb@xxxxxxxxx> writes:

> 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.

OK.  

While at it, we could also place $allowed_users_file inside a pair
of double quotes, as the "test -f" before the part we are touching
is prepared to have $IFS whitespace in it (perhaps inside $GIT_DIR),
but I am OK to leave it as a #leftoverbit outside this topic.



> Signed-off-by: Beat Bolli <dev+git@xxxxxxxxx>
> ---
>  Documentation/howto/update-hook-example.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/howto/update-hook-example.txt b/Documentation/howto/update-hook-example.txt
> index 151ee84cebce..4e727deedd21 100644
> --- a/Documentation/howto/update-hook-example.txt
> +++ b/Documentation/howto/update-hook-example.txt
> @@ -100,7 +100,7 @@ info "The user is: '$username'"
>  
>  if test -f "$allowed_users_file"
>  then
> -  rc=$(cat $allowed_users_file | grep -v '^#' | grep -v '^$' |
> +  rc=$(grep -Ev '^(#|$)' $allowed_users_file |
>      while read heads user_patterns
>      do
>        # does this rule apply to us?
> @@ -138,7 +138,7 @@ info "'$groups'"
>  
>  if test -f "$allowed_groups_file"
>  then
> -  rc=$(cat $allowed_groups_file | grep -v '^#' | grep -v '^$' |
> +  rc=$(grep -Ev '^(#|$)' $allowed_groups_file |
>      while read heads group_patterns
>      do
>        # does this rule apply to us?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux