Created
September 9, 2012 07:01
-
-
Save and1truong/3683087 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| VARIABLE="Let's test this string!" | |
| # This is for regular expressions: | |
| if [[ "$VARIABLE" =~ "Let's.*ring" ]] | |
| then | |
| echo "matched" | |
| else | |
| echo "nope" | |
| fi | |
| # And here we have Bash Patterns: | |
| if [[ "$VARIABLE" == L*ing! ]] | |
| then | |
| echo "matched" | |
| else | |
| echo "nope" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment