Using bash I have a string that holds my deployed applications:
APPS="myapp-a-1.0.war myapp-b-1.1.war myapp-c-1.2-SNAPSHOT.war"
I can determine whether a specific app is deployed:
if [[ "$APPS" == *myapp-a* ]]
then
echo "myapp-a is deployed, but we don't know the version."
fi
How can I retrieve the complete matching word (application with version) given that I only have the words prefix (application name, e.g. 'myapp-a')?