Bash function to find contents of a file with a certain extension
You can use [[ .. ]] instead of [ .. ] to do tests.  The former is a bash builtin and saves a fork.

You don't need to eval anything since you're just building a couple of optional switches to grep.  Start with empty strings and populate variables or an array, and pass the result to an invocation of grep as variables.  This also avoids enumerating every possible combination of arguments (already 4 combos with 2 options -- that approach quickly becomes unsustainable).

There's no need to absorb searchTerm.  Just leave it in the arguments and pass all those to grep, which allows you to include grep switches too, like -i.

Use set +x to see what's going on.

Tying it all together:

findInFile() {
    :&lt;&lt;_comment_
        Function to be placed in bash profile
        Allows user to specify what contents of a file they are looking for
        in what file types and in what NOT file types
        Iterate over the number of scripts arugments
_comment_
    declare -a select
    while [[ "$#" -gt 0 ]]
    do
        if [[ $1 =~ ^(-ft|--fileTypes|-et|--excludeTypes)$ ]]
        then
            local type="$2"
            [[ "$type" == *,* ]] &amp;&amp; type="{$type}"
            if [[ $1 == *-f* ]]
            then 
                select+=( "--include=*$type" )
            else
                select+=( "--exclude=*$type" )
            fi
            shift 2
        else
            break
        fi
    done
    set -x
    grep -r ${select[@]} "$@" .
    { set +x; } 2&gt;/dev/null
}


You can include long comments as here-docs piped to the null operator :.