Re: Convert 08 to decimal 8



Stephane CHAZELAS wrote:
2007-09-07, 15:35(+01), SiKing:
[...]
Hmmm, I am going to have to use "s/^0*//", because I have leading zeros (zeroes?) - plural.
[...]

That will turn 0 or 000 into the empty string.

Right, I just figured that out too. :(

But can bash not do this on its own?
[...]

bash, non standard:

What does that mean?

a=$((10#$a))

So that(!) is the secret syntax...

standard:

case a in (0*[!0]*) a=${a#${a%%[!0]*}};; esac

Whoa! That took me like 10 minutes to parse in my head.

Thank You!
.



Relevant Pages

  • Re: Convert 08 to decimal 8
    ... That will turn 0 or 000 into the empty string. ... bash, non standard: ...
    (comp.unix.shell)
  • Re: Text splitten
    ... als dreiA?ig Jahren nicht mehr aktualisierten Standard entsprechen ("to ... Der Mindestanstand haette es Dir geboten, Dich ueber Archive/FAQ ... Mich interessiert weder bash noch dash die Bohne. ... Shells sind meiner Erfahrung nach in der Praxis die einzigen Abweichungen ...
    (de.comp.os.unix.shell)
  • Re: Implementation errors in strtol()
    ... I'd value the C standard higher than Posix. ... no conversion error is permissible. ... It's quite obvious that any other system differs from FreeBSD here. ... differently than an empty string, and as both the C and Posix/SUSP ...
    (freebsd-current)
  • Re: POSIX und Redirection von Prozessen
    ... Da bleibt also nichts anderes als händisches Nachbauen im Filesystem übrig, ... ich habe genug von dem Pfusch und wechsle wieder zur Bash. ... Im Gegensatz zu <verwende ich Arrays ... ist die Erwartung, etwas, das von vornherein nicht dem Standard folgt, ...
    (de.comp.os.unix.shell)
  • Re: logging everything on bash
    ... hiwa wrote: ... to/from bash and all the processes ... invoked from it on gnome-terminals, ... every activities on standard out, ...
    (comp.os.linux.misc)