Dnia 2013-08-03, o godz. 21:37:10
Ulrich Mueller <u...@gentoo.org> napisał(a):

> >>>>> On Sat, 3 Aug 2013, Michał Górny wrote:
> 
> > Dnia 2013-08-03, o godz. 17:54:42 Ulrich Mueller <u...@gentoo.org>
> > napisał(a):
> 
> >> This looks just horrible. You do decimal arithmetic on octal
> >> numbers?
> 
> > Yes. Bash wasn't really happy to do octal arithmetic for me. Yet in
> > this particular case, with proper assumptions, decimal arithmetic is
> > practically equivalent.
> 
> Do you consider that in future maybe someone else has to maintain that
> code? IMHO we should avoid such hacks.

Well, the code isn't really supposed to need much maintenance. And it
becomes obsolete as soon as we switch to bash-4. I've already added
additional:

  if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then
    echo -n "${w^}"
  else
    # current snippet
  fi

Anyway, given the comments and specific case, I doubt it should be
a real issue. 

> Why don't you do the calculations in decimal throughout? You can
> convert to octal (using printf) in the last step.

I consider that a pointless conversion, esp. that it doesn't 
make a difference code-wise.

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to