Re: [PATCH v2 0/1] [PATCH v2 0/1] [GSOC 2025] [Newbie] userdiff: add built-in pattern for shell scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 18, 2025 at 10:36 AM Moumita <dhar61595@xxxxxxxxx> 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.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux