From: Eric Sunshine Date: Tue, 18 Feb 2025 17:30:47 GMT Subject: Re: [PATCH v2 0/1] [PATCH v2 0/1] [GSOC 2025] [Newbie] userdiff: add built-in pattern for shell scripts Message-ID: In-Reply-To: <20250218153537.16320-1-dhar61595@gmail.com> On Tue, Feb 18, 2025 at 10:36 AM Moumita 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.