Message ID | 20250218153537.16320-1-dhar61595@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | userdiff: add built-in pattern for shell scripts | expand |
On Tue, Feb 18, 2025 at 10:36 AM Moumita <dhar61595@gmail.com> wrote: > The modifications that I made were - > "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*\\([ \t]*\\)[ \t]*" - so that is allows foo() and foo ( ). > "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*\\([ \t]*\\)[ \t]*(\\{|\\(|\\[\\[)" - so that it recognises {, (, or [[ as function bodies Regarding this last point, for completeness, I had meant to respond to j6t's review of your patch by saying that, according to POSIX, a function body can be any compound command, which means the body does not need to be encased in braces. For instance, this works: $ foo() echo nothing $ foo nothing $ That said, I doubt that this usage is common, thus is probably not worth worrying about.