bash substring regex matching wildcard
I am doing bash , i try to test if the substring "world" in the given
variable x. I have part of code working. But the other one not working. I
want to figure out why
First one is working
x=helloworldfirsttime
world=world
if [[ "$x" == *$world* ]];then
echo matching helloworld
Second one is not working
x=helloworldfirsttime
if [[ "$x" == "*world*" ]];then
echo matching helloworld
How to make second one work without using variable like the 1st method
Can someone fix the second one for me.. thanks
No comments:
Post a Comment