OS & Shell/bash
[bash] existStr
냐옴
2019. 2. 15. 12:00
existStr
existStr() { if [[ $1 == *"$2"* ]]; then echo true else echo false fi } ret1=$(existStr "Server start up in" "start") ret2=$(existStr "Server start up in" "Start") if $ret1; then echo "ret1 is true" else echo "ret1 is false" fi if $ret2; then echo "ret2 is true" else echo "ret2 is false" fi |
# output
ret1 is true ret2 is false |