How can I grep complex strings in variables?

if echo “$long_str” | grep -q “$shrt_str”;then echo “found” fi or echo “$long_str” | grep -q “$shrt_str” && echo “found” || echo “not found” But since you are using bash shell, then use shell internals. No need to call external commands shrt_str=”guide” case “$long_str” in *”$shrt_str”* ) echo “Found”;; * ) echo “Not found”;; esac

How to check if a value is equal or not equal to one of multiple values in Lua?

Your problem stems from a misunderstanding of the or operator that is common to people learning programming languages like this. Yes, your immediate problem can be solved by writing x ~= 0 and x ~= 1, but I’ll go into a little more detail about why your attempted solution doesn’t work. When you read x … Read more