Scott M. Mcdermott

UNIX Systems & Network Administrator
available for contract or salaried positions

get_colonsep_field

#
# get designated field from a colon separated string
#

source ~/lib/sh/include
require freturn

function \
get_colonsep_field ()
{
        local +i string=$1
        local -i offset=$2
        local -a fields=($(IFS=:; echo $string))

        freturn ${fields[offset]}
}
# vim:syn=sh:ft=sh