On 09/15/11 23:24, Abel Abraham Camarillo Ojeda wrote:
On Thu, Sep 15, 2011 at 4:19 PM, Pascal Stumpf<pascal.stu...@cubes.de>  wrote:
On Thu, Sep 15, 2011 at 12:06:14PM +0000, Thorsten Glaser wrote:
Abel Abraham Camarillo Ojeda<acamari<at>  verlet.org>  writes:

Some of our shell scripts that work with dates and do something like:

month=`date +%m`
something&&  month=$((month-1))

month=10#$(date +%m)

Is that a mkshism?


The easiest solution here is:

typeset -Z2 month



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


While the OT was not how to handle 0<number> as a decimal number, I am stunned that noone has suggested ${month#0} or ${month##+(0)} yet. The latter may possibly be less portable though.

/Alexander

Reply via email to