From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fed1rmmtao04.cox.net ([68.230.241.35]) by speech.braille.uwo.ca with esmtp (Exim 3.36 #1 (Debian)) id 1DGlz8-0007kj-00 for ; Wed, 30 Mar 2005 17:48:26 -0500 Received: from nedelko83f1172 ([68.228.49.78]) by fed1rmmtao04.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with SMTP id <20050330224750.BOQZ15592.fed1rmmtao04.cox.net@nedelko83f1172> for ; Wed, 30 Mar 2005 17:47:50 -0500 Message-ID: <008301c5357a$892961c0$4e31e444@nedelko83f1172> From: "Ned" To: "Speakup is a screen review system for Linux." References: <000801c53493$fbd20890$4e31e444@nedelko83f1172> <20050330201653.GA18561@sunset.net> Date: Wed, 30 Mar 2005 15:48:02 -0700 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: how to get the last word from file X-BeenThere: speakup@braille.uwo.ca X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Speakup is a screen review system for Linux." List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2005 22:48:26 -0000 This is yet to be seen! Wow, what a syntax. semicolon at the end of if, elif, then, and the most apealing is that fi at the end. Thanks a lot! It's a totally new stuff to me. Is there a case structure in bash? That would fit here just perfectly. Many thanks! Ned ----- Original Message ----- From: "Ralph W. Reid" To: "Speakup is a screen review system for Linux." Sent: Wednesday, March 30, 2005 1:16 PM Subject: Re: how to get the last word from file > On Tue, Mar 29, 2005 at 12:17:43PM -0700, Ned wrote: >> Hi list, >> I am using the cal command to get current month. What I need for my shell >> script is how many days are there in the current month, that is, the last >> listed date for that month is that very number. >> How can I get that number? >> cal | tail -1 >> and then what? >> >> Many thanks! >> Ned > > The above command line will produce a blank line because the last line > produced by `cal` is a blank line. If you are looking specifically > for days in the current month (as opposed to a more general > last-word-in file search), the following is one of several ways to > produce it: > > if [ `cal | grep -c 31` == 1 ]; > then > echo 31 > elif [ `cal | grep -c 30` == 1 ]; > then > echo 30 > elif [ `cal | grep -c 29` == 1 ]; > then > echo 29 > elif [ `cal | grep -c 28` == 1 ]; > then > echo 28 > else > echo Cal did not produce a calendar. > fi > > HTH, and have a _great_ day! > > -- > Ralph. N6BNO. Wisdom comes from central processing, not from I/O. > rreid@sunset.net http://personalweb.sunset.net/~rreid > ...passing through The City of Internet at the speed of light! > _PI = 4 * ARCTAN (1) > > _______________________________________________ > Speakup mailing list > Speakup@braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup >