git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Optional limit for number of lines generated by script

From
Andreas Schwab <schwab@linux-m68k.org>
Date
Jul 13, 2010, 21:43 UTC
Message-ID
<m2vd8jhxbd.fsf@igel.home>
In-Reply-To
<1279055909-4340-1-git-send-email-kpfleming@digium.com>
"Kevin P. Fleming" <kpfleming@digium.com> writes:
Show 9 quoted lines
> @@ -642,6 +647,27 @@ show_new_revisions()
>  }
>  
>  
> +limit_lines()
> +{
> +    lines=0
> +    skipped=0
> +    while IFS="" read line
You probably want to use read -r.
Show 7 quoted lines
> +    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."
Previous: Kevin P. FlemingNext: Kevin P. Fleming
Message 6 of 11 in “Add support for limiting number of lines generated in messages by post-receive-email”
  1. Add support for limiting number of lines generated in messages by post-receive-emailKevin P. Fleming, Jul 8, 2010
  2. Marc BranchaudJul 12, 2010
  3. Kevin P. FlemingJul 13, 2010
  4. Ævar Arnfjörð BjarmasonJul 12, 2010
  5. Optional limit for number of lines generated by scriptKevin P. Fleming, Jul 13, 2010
  6. Andreas SchwabJul 13, 2010
  7. post-receive-email: optional message line count limitKevin P. Fleming, Jul 15, 2010
  8. Junio C HamanoJul 15, 2010
  9. Kevin P. FlemingJul 16, 2010
  10. post-receive-email: optional message line count limitKevin P. Fleming, Jul 16, 2010
  11. Marc BranchaudJul 14, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.