Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT-is there a way to do this in unix - date question

Re: OT-is there a way to do this in unix - date question

From: Jared Still <jkstill_at_gmail.com>
Date: Wed, 2 Feb 2005 18:36:19 -0800
Message-ID: <bf46380502021836e716e56@mail.gmail.com>


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_at_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
Received on Wed Feb 02 2005 - 21:38:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US