I forgot to reindent part of the function after moving the if (( $+commands[shellcheck] )) check into the function. Before it was wrapping the function definition.
grep
~/media/