#!/bin/bash if [ `echo "hogefuga" | grep "fuga"` ]; then echo "ok" fi # または if echo "hogefuga" | grep -q "fuga"; then echo "ok" fi