From oracle-l-bounce@freelists.org  Wed Feb  2 21:38:58 2005
Return-Path: <oracle-l-bounce@freelists.org>
Received: from air891.startdedicated.com (root@localhost)
 by orafaq.com (8.12.10/8.12.10) with ESMTP id j133cw7t026979
 for <oracle-l@orafaq.com>; Wed, 2 Feb 2005 21:38:58 -0600
X-ClientAddr: 206.53.239.180
Received: from turing.freelists.org (freelists-180.iquest.net [206.53.239.180])
 by air891.startdedicated.com (8.12.10/8.12.10) with ESMTP id j133cwem026975
 for <oracle-l@orafaq.com>; Wed, 2 Feb 2005 21:38:58 -0600
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 5DF176CA37;
 Wed,  2 Feb 2005 21:38:02 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 27324-06; Wed, 2 Feb 2005 21:38:02 -0500 (EST)
Received: from turing (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id D600B6CBF9;
 Wed,  2 Feb 2005 21:38:01 -0500 (EST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references;
        b=kVFv2pQ3YEZvLPI3cIhjLKusMXD4KVq4uPU/UgqnJiTviuR1lRkw3Lepsd5PmuZlfacfjvQacFzTlRNN/U/9pWmaBgGbLjUnAuPcWiTZFWcnas2PlZrD2D8RPQzWpWOKgJgRnoP+N+h+nJbLI3Li3hYgMh7lLUS5t9ne+H8w468=
Message-ID: <bf46380502021836e716e56@mail.gmail.com>
Date: Wed, 2 Feb 2005 18:36:19 -0800
From: Jared Still <jkstill@gmail.com>
To: ganstadba@hotmail.com
Subject: Re: OT-is there a way to do this in unix - date question
Cc: oracle-l@freelists.org
In-Reply-To: <BAY20-DAV127AF5E455B09179092D0A67E0@phx.gbl>
Mime-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
References: <BAY20-DAV127AF5E455B09179092D0A67E0@phx.gbl>
X-archive-position: 15720
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-To: oracle-l-bounce@freelists.org
X-original-sender: jkstill@gmail.com
Precedence: normal
Reply-To: jkstill@gmail.com
X-list: oracle-l
X-Virus-Scanned: by amavisd-new-20030616-p9 (Debian) at avenirtech.net
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on 
 air891.startdedicated.com
X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=ham version=2.60
X-Spam-Level: 

This works in bash and korn.  Put it into your .kshrc or .bashrc

initmonths() {
   typeset m
   typeset i
   echo Initializing months...
   for m in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
   do
      ((i=i+1))
      months[$i]=$m
   done
}

getmonth() {
   typeset n=$1
   [ -z "${months[${n}]}" ] && initmonths
   echo ${months[${n}]}
}

getmonth 4
getmonth 7
getmonth 11

That was fun, I should do more of that.  :)



On Wed, 2 Feb 2005 14:12:23 -0500, Michael McMullen
<ganstadba@hotmail.com> wrote:
> without writing a whole series of ifs, given a number 1 - 12 give the
> corresponding three letter month
> like what you get with date +%b, but someone supplies you the digits
> --
> http://www.freelists.org/webpage/oracle-l
> 


-- 
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist
--
http://www.freelists.org/webpage/oracle-l

