SyntaxFix
Write A Post
Hire A Developer
Questions
This works in Bash without forking external commands:
function has_substring() { [[ "$1" != "${2/$1/}" ]] }
Example usage:
name="hello/world" if has_substring "$name" "/" then echo "Indeed, $name contains a slash!" fi