[Top][All Lists]

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

!(*/) should expand to all non-directory files in a directory.

From: lhunath
Subject: !(*/) should expand to all non-directory files in a directory.
Date: Wed, 22 Jun 2011 16:40:14 +0200 (CEST)

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: darwin10.7.1
Compiler: /usr/bin/gcc-4.2
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='darwin10.7.1' -DCONF_MACHTYPE='i386-apple-darwin10.7.1' 
-DCONF_VENDOR='apple' -DLOCALEDIR='/opt/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I. -I./include -I./lib  
-I/opt/local/include -pipe -O2 -arch x86_64
uname output: Darwin Myst 10.7.4 Darwin Kernel Version 10.7.4: Mon Apr 18 
21:24:17 PDT 2011; root:xnu-1504.14.12~3/RELEASE_X86_64 x86_64
Machine Type: i386-apple-darwin10.7.1

Bash Version: 4.2
Patch Level: 8
Release Status: release

        There should be a glob expression that can expand all non-directories, 
similar to the */ that expands all directories.
    Possible options for such a glob could be !(*)/, *!(/) and !(*/).

    The current behaviour for these globs can be argued to be 'by design', but 
perhaps we could extend the pathname expansion code to include support for this 

    !(*)/ -- Could be argued to mean: [ Not any file or directory ] that is a 
directory.  Which obviously is the empty set.
    *!(/) and !(*/) -- We currently cannot put slashes in extglobs.

    Perhaps the latter two are good candidates for introducing this 

        touch a b; mkdir c d
    echo "files:       " */ @(*)/ @(*/)
    echo "directories: " !(*)/ *!(/) !(*/)

    The proposed solution is to add limited support for slashes in extglob 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]