Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Alexander Hall
On 09/15/11 23:24, Abel Abraham Camarillo Ojeda wrote: On Thu, Sep 15, 2011 at 4:19 PM, Pascal Stumpf wrote: On Thu, Sep 15, 2011 at 12:06:14PM +, Thorsten Glaser wrote: Abel Abraham Camarillo Ojeda verlet.org> writes: Some of our shell scripts that work with dates and do something lik

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Abel Abraham Camarillo Ojeda
On Thu, Sep 15, 2011 at 5:46 PM, Thorsten Glaser wrote: > Abel Abraham Camarillo Ojeda dixit: > >>I meant portable among other shells, or bourne shell... > > They donbt have $((b&)) either, sob& > > bye, > //mirabilos > -- > Yay for having to rewrite other people's Bash scripts because bash > sud

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Thorsten Glaser
Abel Abraham Camarillo Ojeda dixit: >On Thu, Sep 15, 2011 at 4:19 PM, Pascal Stumpf 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

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Pascal Stumpf
On Thu, Sep 15, 2011 at 09:58:13PM +, Thorsten Glaser wrote: > >> typeset -Z2 month > > That can break as soon as month is made an integer someplace down. And that's very likely to happen ... > Padding is meant for output, not input. You don't know if $month is input or output. > tg@stink

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Thorsten Glaser
Abel Abraham Camarillo Ojeda dixit: >I meant portable among other shells, or bourne shell... They donbt have $((b&)) either, sob& bye, //mirabilos -- Yay for having to rewrite other people's Bash scripts because bash suddenly stopped supporting the bash extensions they make use of -- To

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Abel Abraham Camarillo Ojeda
On Thu, Sep 15, 2011 at 4:58 PM, Thorsten Glaser wrote: > Abel Abraham Camarillo Ojeda dixit: > >>On Thu, Sep 15, 2011 at 4:19 PM, Pascal Stumpf wrote: > month=10#$(date +%m) >>> >>> Is that a mkshism? > > No, that's proper Korn shell. > >>> The easiest solution here is: >>> >>> typeset -Z2

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Pascal Stumpf
On Thu, Sep 15, 2011 at 04:24:37PM -0500, Abel Abraham Camarillo Ojeda wrote: > Yep, I did that in some scripts, just > don't know how portable it is... I haven't come across a single ksh that doesn't support that. Even the old ksh88 on AIX 4.3.3 at my university has it.

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Abel Abraham Camarillo Ojeda
On Thu, Sep 15, 2011 at 4:19 PM, Pascal Stumpf wrote: > On Thu, Sep 15, 2011 at 12:06:14PM +, Thorsten Glaser wrote: >> Abel Abraham Camarillo Ojeda verlet.org> writes: >> >> > Some of our shell scripts that work with dates and do something like: >> > >> > month=`date +%m` >> > something && m

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Pascal Stumpf
On Thu, Sep 15, 2011 at 12:06:14PM +, Thorsten Glaser wrote: > Abel Abraham Camarillo Ojeda 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 mkshis

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Henning Brauer
* Thorsten Glaser [2011-09-15 14:15]: > Abel Abraham Camarillo Ojeda 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) awesome. trying to be clever is always so

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-15 Thread Thorsten Glaser
Abel Abraham Camarillo Ojeda 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) bye, //mirabilos

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-12 Thread Abel Abraham Camarillo Ojeda
On Mon, Sep 12, 2011 at 5:08 PM, Tobias Ulmer wrote: > > Fix your script, add the leading zero after you're done with the > calculation. > I'm already doing that, just wasn't sure if it was a bug... Thanks.

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-12 Thread Tobias Ulmer
On Mon, Sep 12, 2011 at 04:45:28PM -0500, Abel Abraham Camarillo Ojeda wrote: > Some of our shell scripts that work with dates and do something like: > > month=`date +%m` > something && month=$((month-1)) > > Suddenly started crashing on august... there seems to be a bug identifying > not-numbers

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-12 Thread Alexander Polakov
* Abel Abraham Camarillo Ojeda [110913 01:46]: > Some of our shell scripts that work with dates and do something like: > > month=`date +%m` > something && month=$((month-1)) > > Suddenly started crashing on august... there seems to be a bug identifying > not-numbers (numbers with leading zeroes)

Re: ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-12 Thread Aner Perez
On 09/12/2011 05:45 PM, Abel Abraham Camarillo Ojeda wrote: Some of our shell scripts that work with dates and do something like: month=`date +%m` something&& month=$((month-1)) Suddenly started crashing on august... there seems to be a bug identifying not-numbers (numbers with leading zeroes)

ksh: bad number (with leading zeroes) should not work for 0 - 7

2011-09-12 Thread Abel Abraham Camarillo Ojeda
Some of our shell scripts that work with dates and do something like: month=`date +%m` something && month=$((month-1)) Suddenly started crashing on august... there seems to be a bug identifying not-numbers (numbers with leading zeroes) before '08' (eigth), how to reproduce: $ for i in 0{0,1,2,3,