Spliting strings in Bash
Using string modifiers to extract part of a string
$ x=a:b:c
$ echo ${x%:*}
a:b
$ echo ${x%%:*}
a
$ echo ${x#*:}
b:c
$ echo ${x##*:}
c
Using string modifiers to extract part of a string
$ x=a:b:c
$ echo ${x%:*}
a:b
$ echo ${x%%:*}
a
$ echo ${x#*:}
b:c
$ echo ${x##*:}
c