Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Dan Douglas
On Wednesday, July 23, 2014 05:44:25 PM Dan Douglas wrote: > On Wednesday, July 23, 2014 05:02:42 PM Chet Ramey wrote: > > ksh93 -c 'echo $(( 010 ))' > > Oh heh. Maybe a compile-time option or something I'm doing wrong... I always > assumed it intentionally violates POSIX. > > I also just notice

Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Dan Douglas
On Wednesday, July 23, 2014 05:02:42 PM Chet Ramey wrote: > ksh93 -c 'echo $(( 010 ))' Oh heh. Maybe a compile-time option or something I'm doing wrong... I always assumed it intentionally violates POSIX. I also just noticed zsh interprets it in bash and sh mode but not ksh or zsh mode. (it's t

Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Chet Ramey
On 7/23/14, 4:49 PM, Dan Douglas wrote: > I don't believe there are any cases in which ksh interprets a leading > zero, at least not current versions. If you want octal you must use > either 8#num or typeset -ibase. Same applies to both zsh and mksh > AFAICT. $ ksh93 -c 'echo $(( 010 ))' 8 Posix

Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Dan Douglas
On Wed, Jul 23, 2014 at 1:29 PM, Chet Ramey wrote: > On 7/23/14, 3:20 AM, maik.lied...@sungard.com wrote: >> hello, >> >> to change our scripts from ksh to bash we have problems with vars and >> leading zeros. >> how we can declare hrs and min? > > Greg offered several good suggestions to force b

Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Chet Ramey
On 7/23/14, 3:20 AM, maik.lied...@sungard.com wrote: > hello, > > to change our scripts from ksh to bash we have problems with vars and leading > zeros. > how we can declare hrs and min? Greg offered several good suggestions to force base 10 in certain situations. > or can we disable the automa

Re: leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Greg Wooledge
On Wed, Jul 23, 2014 at 07:20:01AM +, maik.lied...@sungard.com wrote: > how we can declare hrs and min? > or can we disable the automatic change from decimal to octal? Strip the leading zeroes, or force base 10 with 10#$foo inside the math context. > TIME="08:09" Using all-caps variables is

leading zeros ignored by perl, ksh. not bash

2014-07-23 Thread Maik.Liedtke
hello, to change our scripts from ksh to bash we have problems with vars and leading zeros. how we can declare hrs and min? or can we disable the automatic change from decimal to octal? leading zeros ignored by perl, ksh. not bash cannnot declare vars hrs and min as decimal only user@host