git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: "Kevin P. Fleming" <kpfleming@digium.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Optional limit for number of lines generated by script
Date: Tue, 13 Jul 2010 23:43:50 +0200	[thread overview]
Message-ID: <m2vd8jhxbd.fsf@igel.home> (raw)
In-Reply-To: <1279055909-4340-1-git-send-email-kpfleming@digium.com> (Kevin P. Fleming's message of "Tue, 13 Jul 2010 16:18:29 -0500")

"Kevin P. Fleming" <kpfleming@digium.com> writes:

> @@ -642,6 +647,27 @@ show_new_revisions()
>  }
>  
>  
> +limit_lines()
> +{
> +    lines=0
> +    skipped=0
> +    while IFS="" read line

You probably want to use read -r.

> +    do
> +	lines=$((lines + 1))
> +	if [ $lines -gt $1 ]
> +	then
> +	    skipped=$((skipped + 1))
> +	else
> +	    echo "$line"

            printf '%s\n' "$line"

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2010-07-13 21:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-08 19:03 [PATCH] Add support for limiting number of lines generated in messages by post-receive-email Kevin P. Fleming
2010-07-12 16:47 ` Marc Branchaud
2010-07-13 20:56   ` Kevin P. Fleming
2010-07-12 17:10 ` Ævar Arnfjörð Bjarmason
2010-07-13 21:18   ` [PATCH] Optional limit for number of lines generated by script Kevin P. Fleming
2010-07-13 21:43     ` Andreas Schwab [this message]
2010-07-15 14:51       ` [PATCH] post-receive-email: optional message line count limit Kevin P. Fleming
2010-07-15 17:36         ` Junio C Hamano
2010-07-16 19:13           ` Kevin P. Fleming
2010-07-16 19:16           ` Kevin P. Fleming
2010-07-14 16:41     ` [PATCH] Optional limit for number of lines generated by script Marc Branchaud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2vd8jhxbd.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=git@vger.kernel.org \
    --cc=kpfleming@digium.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).