Answers for "if a variable has a value bash"

3

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
0

bash if set variable

if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi
Posted by: Guest on December-02-2020

Code answers related to "if a variable has a value bash"

Browse Popular Code Answers by Language