#!/bin/bash THIS=$(basename $0) if [[ "$1" == "-v" ]]; then VERBOSE=verbose shift fi FINDCMD="find " # exclusions FINDCMD+="-type d \( " FINDCMD+="-path '*/.hg' -o " FINDCMD+="-path '*/.git' " FINDCMD+=" \) -prune -o " # search for exact match FINDCMD+="-name '$1' " FINDCMD+="-exec vim {} +" [[ -n $VERBOSE ]] && echo $THIS: FINDCMD=$FINDCMD eval $FINDCMD