Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash substring test

#!/bin/bash

STR='GNU/Linux is an operating system'
SUB='Linux'

if grep -q "$SUB" <<< "$STR"; then
  echo "It's there"
fi
Source by linuxize.com #
 
PREVIOUS NEXT
Tagged: #bash #substring #test
ADD COMMENT
Topic
Name
1+8 =