Abel Abraham Camarillo Ojeda dixit:

>On Thu, Sep 15, 2011 at 4:19 PM, Pascal Stumpf <pascal.stu...@cubes.de> wrote:

>>> month=10#$(date +%m)
>>
>> Is that a mkshism?

No, that's proper Korn shell.

>> The easiest solution here is:
>>
>> typeset -Z2 month

That can break as soon as month is made an integer someplace down.
Padding is meant for output, not input.

>Yep, I did that in some scripts, just
>don't know how portable it is...

tg@stinky:~ $ /bin/ksh -c 'i=10#08; print $((i)) $(uname -a)'
8 SunOS stinky 5.8 Generic_117350-61 sun4u sparc SUNW,Sun-Fire-V210 Solaris

So, portable across all Korn shells.

bye,
//mirabilos
-- 
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh

Reply via email to