Bash substring
Does var
contain 'substring'?
This works by using string substitution: if removing the substring from the variable results in a string different from the original, we know the latter contains the former - otherwise, it would remain unchanged.
Last updated