#!/bin/bash # Test: stringContain [-i] "sub string" "full string" stringContain() { if [[ $1 == -i ]] ; then case ${3,,} in *${2,,}*) return ;; *) return 1 ;; esac else case $2 in *$1*) return ;; *) return 1 ;; esac fi }