Skip to content

Instantly share code, notes, and snippets.

@peijiehu
Last active September 1, 2015 00:28
Show Gist options
  • Save peijiehu/4f744780b9b175a39cc0 to your computer and use it in GitHub Desktop.
Save peijiehu/4f744780b9b175a39cc0 to your computer and use it in GitHub Desktop.
Shell: check whether a variable contains certain string or not
# to check whether TEST_OPTIONS contains "-P" or "--parallel", or not
# TEST_OPTIONS can be "-P 20", "--parallel=15", or any string
if [[ "$TEST_OPTIONS" == -P* ]] || [[ "$TEST_OPTIONS" == --paralell* ]]; then echo "yes"; else echo "no"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment