文字列に別の文字列が含まれているか調べる(grep)
#!/bin/sh #str_find_grep.sh text="The quick brown fox jumps over the lazy dog." if echo "$text" | grep -q 'fox'; then echo "found" else echo "not found" fi
$ ./str_find_grep.sh found
#!/bin/sh #str_find_grep.sh text="The quick brown fox jumps over the lazy dog." if echo "$text" | grep -q 'fox'; then echo "found" else echo "not found" fi
$ ./str_find_grep.sh found