Skip to content

Instantly share code, notes, and snippets.

@and1truong
Created September 9, 2012 07:01
Show Gist options
  • Select an option

  • Save and1truong/3683087 to your computer and use it in GitHub Desktop.

Select an option

Save and1truong/3683087 to your computer and use it in GitHub Desktop.
#! /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