Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # with glob patterns
- if [[ $var == *ABC ]]; then echo "$var ends with ABC"; fi
- # with regular expression
- if [[ $var =~ ABC$ ]]; then echo "$var ends with ABC"; fi
- var="hellowordABC"
- echo $var | grep ".*ABC$"
- [[ $var =~ ABC$ ]] && echo "var ends with ABC"
Add Comment
Please, Sign In to add comment