From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Schwab Subject: Re: [PATCH] Optional limit for number of lines generated by script Date: Tue, 13 Jul 2010 23:43:50 +0200 Message-ID: References: <1279055909-4340-1-git-send-email-kpfleming@digium.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org To: "Kevin P. Fleming" X-From: git-owner@vger.kernel.org Tue Jul 13 23:43:59 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OYnGg-0005U1-FD for gcvg-git-2@lo.gmane.org; Tue, 13 Jul 2010 23:43:58 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755917Ab0GMVnx (ORCPT ); Tue, 13 Jul 2010 17:43:53 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:42154 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753889Ab0GMVnw (ORCPT ); Tue, 13 Jul 2010 17:43:52 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 619031C001F7; Tue, 13 Jul 2010 23:43:51 +0200 (CEST) Received: from igel.home (ppp-88-217-106-124.dynamic.mnet-online.de [88.217.106.124]) by mail.mnet-online.de (Postfix) with ESMTP id 24C431C0013B; Tue, 13 Jul 2010 23:43:51 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id DEA3ACA297; Tue, 13 Jul 2010 23:43:50 +0200 (CEST) X-Yow: What a COINCIDENCE! I'm an authorized ``SNOOTS OF THE STARS'' dealer!! 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") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: "Kevin P. Fleming" 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."