Scott M. Mcdermott

UNIX Systems & Network Administrator
available for contract or salaried positions

strip_leading_zeros

#

source ~/lib/sh/include
require freturn

strip_leading_zeros ()
{
        local +i arg=$1
        local -i stripped

        # strip leading zeros so we can use integer attribute
        [[ $arg =~ ^(0+)(.*)$ ]]
        stripped=${BASH_REMATCH[2]:-$arg}

        freturn $stripped
}
# vim:syn=sh:ft=sh