Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT-is there a way to do this in unix - date question
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
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-lReceived on Wed Feb 02 2005 - 21:38:58 CST