Giving up after only 3 hours already?
How about the following:
var=$(echo $TEST | rev | cut -d'/' -f3- | rev)
The cut command allows to specify a character delimiter that acts like a field separator. The parameter -f3- would normally extract the string starting at field number 3 and all remaining fields. The trick is to reverse the order of the string so that the cut command will cut from the end to the beginning, instead from the beginning to the end, and then reverse the string again to get the result.
I have a variable TEST in a bash script
I want to parse this TEST variable to have a new variable COMPOSITE_DIR with value "/ABCService/ZeroComposite".
# dirname `dirname $TEST`