Guest User

Untitled

a guest
Apr 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. # with glob patterns
  2. if [[ $var == *ABC ]]; then echo "$var ends with ABC"; fi
  3.  
  4. # with regular expression
  5. if [[ $var =~ ABC$ ]]; then echo "$var ends with ABC"; fi
  6.  
  7. var="hellowordABC"
  8. echo $var | grep ".*ABC$"
  9.  
  10. [[ $var =~ ABC$ ]] && echo "var ends with ABC"
Add Comment
Please, Sign In to add comment