URL: <https://savannah.gnu.org/bugs/?60540>
Summary: enable extended shell patterns for -name and -iname tests Project: findutils Submitted by: ian_bruce Submitted on: Thu 06 May 2021 11:33:22 PM UTC Category: find Severity: 3 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: Open/Closed: Open Release: None Discussion Lock: Any Fixed Release: None _______________________________________________________ Details: The find(1) manual page states that for the "-name" test, "filename matching is performed with the use of the fnmatch(3) library function." Referring to the manual page for that function, the following flag is specified: FNM_EXTMATCH If this flag (a GNU extension) is set, extended patterns are supported, as introduced by 'ksh' and now supported by other shells. The extended format is as follows, with pattern-list being a '|' separated list of patterns. '@(pattern-list)' The pattern matches if exactly one occurrence of any of the patterns in the pattern-list match the input string. ... However, it does not appear that this flag has been enabled for find(1) : $ ls videofile.avi videofile.mkv videofile.mp4 videofile.wmv $ ls *.@(mp4|avi) videofile.avi videofile.mp4 $ find . -name '*.@(mp4|avi)' [nothing found] Please add this flag to the fnmatch() call, so that find(1) can produce the same matches as the shell would. Presumably, no other code changes would be required. Obviously, this flag should also be enabled for the "-iname" test. If it is thought that enabling this functionality by default would be undesirable for some reason, consider adding "-extname" and "-iextname" tests which include it. In any case, the find(1) manual page should be updated to explain whether or not these extended shell patterns are supported. Thank you. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?60540> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/