Answers for "if no string in bash on variable"

C#
4

check if variable contains string bash

STRING='Hello world'
if [[ $STRING =~ "Hello" ]] ; then echo "It's here" ; fi
Posted by: Guest on April-17-2021
5

bash if variable is not empty

VAR=`echo Hello world`
if [[ -n "$VAR" ]] ; then echo "Variable is set"  ; fi
if [[ -z "$VAR" ]] ; then echo "Variable is null" ; fi
Posted by: Guest on April-12-2021

Code answers related to "if no string in bash on variable"

C# Answers by Framework

Browse Popular Code Answers by Language