Hello
I have a var="STEPHEN,GRIFFITHS"
how can i check to see if a variable contains a certain character, ie a comma (,)
Thanks
Hello
I have a var="STEPHEN,GRIFFITHS"
how can i check to see if a variable contains a certain character, ie a comma (,)
Thanks
if echo "$var" | grep "," >/dev/null 2>&1
then
echo "Variable contains char."
else
echo "Variable does not contain char."
fi
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.