SyntaxFix
Write A Post
Hire A Developer
Questions
A solution using the read builtin:
IFS=':' read -a fields <<< "1:2:3:4:5" echo "${fields[4]}"
Or, to make it more generic:
echo "${fields[-1]}" # prints the last item