Shellscript `grep` execution not working as in the interactive shell
up vote
0
down vote
favorite
Having to deal with an environment where ack and so on is not available nor installable, this command try to limit only relevant files to find string through the C++ project : grep pattern --color -- /project/path/**/*.*([chCH]|cc|cxx|[ch]pp|py) This does the job. Now to bring a bit more commodity to that, the goal is to put that into a shell script. Let's say it's named wrapped_grep . Here is the content of wrapped_grep : #!/usr/bin/env bash shopt -s extglob # enable advanced pattern matching grep $1 --color -- /project/path/**/*.*([chCH]|cc|cxx|[ch]pp|py) But trying to launch wrapped_grep pattern don't provide any output, even when the equivalent direct grep query does find matches as expected. What is missing in this script to provide the same result as the direct grep in...