Skip to content

Instantly share code, notes, and snippets.

@napsternxg
Created February 13, 2013 16:37
Show Gist options
  • Save napsternxg/4945905 to your computer and use it in GitHub Desktop.
Save napsternxg/4945905 to your computer and use it in GitHub Desktop.
Check for presence of variables in a string. Like help="This is a string containing a $VARIABLE in it" The script will echo TRUE using regex match.
if [[ "$help" =~ (\$[A-Za-z0-9]*) ]]; then echo "TRUE"; else echo "FALSE"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment