I'm trying to check if given string contains another. It should go like:
Case 1: "abc" in "abc" # True
Case 2: "ab" in "abc" # True
Case 3: "x" in "abc" # False
if test $(findstring "ab", "abc"); then \
echo "YES"; \
else \
echo "NO "; \
fi;
# NO
It seems that findstring
is matching words only but not searching substrings (it is not correct for Case 2). Is there another simple way to do it?