#!/bin/bash if [ -n $2 ] grep -r --include="*.$2" "$1" . else grep -r "$1" . fi