Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

shell: search a string if it contains another string

# Search for a substring in another string using wildcard

string='My long string'
substr='My long'

# Note: the wildcard character (*) is outside the double qoute ("")
if [[ "$string" == *"$substr"* ]]; then
  echo "Found substring!"
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: apache config file 
Shell :: pip install ignore errors 
Shell :: check jdk version 
Shell :: linux tail colorful 
Shell :: command separate words into lines 
Shell :: bash folder size 
Shell :: install flask on ubuntu 
Shell :: install obs studio ubuntu 
Shell :: ionic 4 install bootstrap 
Shell :: ubuntu notes install 
Shell :: git remove user password 
Shell :: open android studio project from terminal 
Shell :: how to install .deb file in ubuntu from terminal 
Shell :: clear history centos 
Shell :: uninstall vmware in ubuntu 
Shell :: linux find files by name 
Shell :: how upgrade my notebook 
Shell :: awk print lines when match is found with specific field 
Shell :: bash remove last character 
Shell :: ubuntu installing gimp 
Shell :: ubuntu last logs 
Shell :: ubuntu turn off swap 
Shell :: change branch name git local 
Shell :: git clone from specific branch 
Shell :: how to install gatsby with typescript 
Shell :: bash sort strings by frequency 
Shell :: how to collect GREPCC coin in grepper 
Shell :: add to path windows powershell 
Shell :: remove global configuration in git 
Shell :: bash fully unsquash sqfs file 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =