I\'m trying to write a bash function that uses nocasematch without changing the callers setting of the option. The function definition is:
nocasematch
is_he
The function body can be any compound command, not just a group command ( {} ). Use a sub-shell:
{}
is_hello_world() ( shopt -s nocasematch [[ "$1" =~ "hello world" ]] )