Posted By

aresnick on 11/05/08


Tagged

String substring contains


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

scilec
jrhurley


Checking if a string contains a substring in Bash


 / Published in: Bash
 

URL: http://stackoverflow.com/questions/229551/string-contains-in-bash

  1. string='My string';
  2.  
  3. if [[ $string == *My* ]]
  4. then
  5. echo "It's there!";
  6. fi

Report this snippet  

You need to login to post a comment.