bug-bash
[Top][All Lists]
Advanced

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

Wishlist: Optionally append '/' to globbed directories (GLOB_MARK)


From: pub_br_debian . org
Subject: Wishlist: Optionally append '/' to globbed directories (GLOB_MARK)
Date: Sat, 24 Sep 2016 21:19:36 +0200 (CEST)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib  -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-31ueiH/bash-4.4=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall 
-Wno-parentheses -Wno-format-security
uname output: Linux pc13 4.6.0-1-amd64 #1 SMP Debian 4.6.4-1 (2016-07-18) 
x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.4
Patch Level: 0
Release Status: release

Description:
        Wishlist bug:
        
        I would like to be able to configure bash so that directory
        names that are the result of globbing have a slash ('/')
        appended to their name. Currently, this seems to be only
        possible for /completion/ (by means of the readline variable
        'mark-directories'), but not for /globbing/.

        Analogous to nullglob, dotglob etc., I suggest a shell option
        named 'markglob', that can be set/unset by 'shopt'.

Repeat-By:
        Current behavior:
          $ mkdir foobar
          $ echo foob*
          foobar
          $

        Desired behavior (only if configured to do so):
          $ mkdir foobar
          $ echo foob*
          foobar/
          $

        Example for zsh's implementation of desired configurable
        feature:
          $ mkdir foobar
          $ echo foob*
          foobar
          $ setopt MARK_DIRS
          $ echo foob*
          foobar/
          $

Fix:
        glob(3) has a flag 'GLOB_MARK' that seems to exhibit the
        desired behavior, at least from the description:

          GLOB_MARK
              Append a slash to each path which corresponds to a
              directory.

        So maybe shell_glob_filename() in pathexp.c and the
        appropriate parts of builtins/shopt.def can be relatively
        easily modified to add the desired feature.



reply via email to

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