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" ]]
)
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" ]]
)