From owner-freebsd-questions@FreeBSD.ORG Thu Nov 5 15:41:24 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D69D106566B for ; Thu, 5 Nov 2009 15:41:24 +0000 (UTC) (envelope-from af.gourmet@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.freebsd.org (Postfix) with ESMTP id D68808FC16 for ; Thu, 5 Nov 2009 15:41:23 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=UTF-8 Received: from [192.168.0.51] ([96.21.103.185]) by VL-MH-MR002.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-4.01 (built Aug 3 2007; 32bit)) with ESMTP id <0KSN00BYH7KYU1N0@VL-MH-MR002.ip.videotron.ca> for freebsd-questions@freebsd.org; Thu, 05 Nov 2009 10:41:23 -0500 (EST) Message-id: <4AF2E413.2080907@videotron.ca> Date: Thu, 05 Nov 2009 10:41:23 -0400 From: PJ User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) To: Ruben de Groot , PJ , Polytropon , "freebsd-questions@freebsd.org" References: <4AF1FF76.60808@videotron.ca> <20091105023045.9a3d90ab.freebsd@edvax.de> <4AF2D277.3090406@videotron.ca> <20091105144609.GA28950@ei.bzerk.org> In-reply-to: <20091105144609.GA28950@ei.bzerk.org> Cc: Subject: Re: and now for conky & gremlins X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2009 15:41:24 -0000 Ruben de Groot wrote: > On Thu, Nov 05, 2009 at 09:26:15AM -0400, PJ typed: > >> Polytropon wrote: >> >>> On Wed, 04 Nov 2009 18:25:58 -0400, PJ wrote: >>> >>> >>>> output should be: 1 2 3 [4] 5 6 7 etc. >>>> is: 1 2 3 4 5 6.... >>>> >>>> the calendar.sh is exactly: >>>> #!/bin/sh >>>> cal | awk 'NR>1' | sed -e 's/ / /g' -e 's/[^ ] /& /g' -e 's/..*/ >>>> &/' -e "s/\ `date +%d`/\[`date +%d`\]/" >>>> >>>> >>> It's quite obviously. Let's try the last substitution >>> argument in plain shell: >>> >>> % date +%d >>> 05 >>> >>> But the command creates this: >>> >>> Su Mo Tu We Th Fr Sa >>> 1 2 3 4 5 6 7 >>> >>> The leading zero is missing, so there's no substition that >>> changes "5" into "[5]", because the search pattern is "05". >>> >>> >> Ok, I see... I'm not too good in programming. I guess I didn't notice >> the previous to the first days of November the date was always 2 >> digits.. how do I get rid of the zero? Regex substitution or something >> like that? >> > > date "+%e" should do it. > Sure did.... For the moment, I changed the [ ] to just plain > maybe that will avoid the disjointed row. But changing the color of the current date sure would be nice... but is there a way to do that?