We can check if a string ends with specific word/string.
Lets try to validate with an example.
Here I am trying to check if a string ends with def given my string is abcdef.
S="abcdef" if [[ "$S" == *def ]] then echo true else echo false fi
Write above mentioned code in a script, here I have written it in tmp.sh file and run script with following command:
$ bash tm.sh
Output:
true