[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
docs incorrectly mention pattern matching works like pathname expansion
From: |
Stormy |
Subject: |
docs incorrectly mention pattern matching works like pathname expansion |
Date: |
Wed, 14 Mar 2018 17:43:36 +0000 (UTC) |
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-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
uname output: Linux testc170 4.1.12-112.14.15.el7uek.x86_64 #2 SMP Thu Feb 8
09:58:19 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
Bash Version: 4.2
Patch Level: 46
Release Status: release
Description:
Section of 'case' in bash's man page says:
case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac
A case command first expands word, and tries to match it
against each pattern in turn, using the same matching
rules as for pathname expansion (see Pathname Expansion below).
but that is not correct, the matching here does NOT follow pathname expansion,
the treatment of "/" is not the same.
Man page should explain that '/' is treated specially in pathname expansion but
not in case pattern
matching. For example '/test/*' will match even '/test/one/two/three' in case
matching, but NOT in path name matching
where "/" is a "separator" and stops matching.
Repeat-By:
case matching on '/test/*' also matches '/test/one/two/three', if it was true
pathname matching, it should not match, only /test/
*/*/* would match in that case.
Fix:
either change case to do pathname matching, like doc says, but that
would probably break many existing scripts. OR, correct
the docs and explain that pathname matching is not possible in bash, i.e.
there is no 'fnmatch' builtin to bash.
~
- docs incorrectly mention pattern matching works like pathname expansion,
Stormy <=
- Re: docs incorrectly mention pattern matching works like pathname expansion, Chet Ramey, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Stormy, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, PePa, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Chet Ramey, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Stormy, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Greg Wooledge, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Chet Ramey, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Stormy, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Chet Ramey, 2018/03/15
- Re: docs incorrectly mention pattern matching works like pathname expansion, Stormy, 2018/03/15