2016-11-20 3 views
3

여기 bash에서 버그를 제안하는 모든 단계가 있습니다. 문제의Bash 문자 클래스 매개 변수 확장 불일치 동작

버전 및 플랫폼 정보

--> cat /etc/os-release 
NAME="Ubuntu" 
VERSION="14.04.5 LTS, Trusty Tahr" 
ID=ubuntu 
ID_LIKE=debian 
PRETTY_NAME="Ubuntu 14.04.5 LTS" 
VERSION_ID="14.04" 
HOME_URL="http://www.ubuntu.com/" 
SUPPORT_URL="http://help.ubuntu.com/" 
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" 
--> bash --version 
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) 
Copyright (C) 2013 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 

This is free software; you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. 

세부 단계 :

--> ls 
--> touch a aa aaa b bb bbb 
--> ls *[:alpha:] 
a aa aaa 
--> rm a aa aaa 
--> ls *[:alpha:] 
ls: cannot access *[:alpha:]: No such file or directory 

왜 것 '* [: 알파 :]'목록 'A *'파일 이름이 아닌 'ㄱ *' 사람?

궁금한 분은 올바른 행동을 취하기 위해 * ([[: alpha :]])를 사용해야합니다. 하지만 여기에 나타나는 불일치는 설명하지 않습니다.

답변

4

불일치가 없습니다. 중복 문자를 제거하면 [:alpha:][:alph]과 같습니다. 그래서 ls *[:alpha:]은 실제로 ls *[:alph]과 같으며 단지 a, aaaaa 만 일치하므로 출력 결과로 표시됩니다. 해당 파일을 삭제하면 ls *[:alph]에 일치하는 항목이 없으므로 수신했습니다.

문자 클래스 [:alpha:]을 사용하려는 경우 은 [[:alpha:]]으로 작성해야합니다.

+0

아, 답변 해 주셔서 감사합니다. – Fireplume