Linux学者必备文件通配符掌握8

3.文件名通配

glob

特殊字符,元字符,不表示字符的表面意义,而是只能


匹配符合指征的字符串;


*:任意长度的任意字符(a*b,a开头到b结尾的);


?:任意单个字符(a?b,a和b之间的一个字符);


[]:匹配制定范围内的任意单个字符(a[axy]b,只能取


[]里的一个)([a-zA-Z]);


ls a[' '][a-zA-Z]显示a开头中间空格的文件;

4.man 7 glob()


[:alnum:] [:alpha:] [:blank:] [:cntrl:]

[:digit:] [:graph:] [:lower:] [:print:]

[:punct:] [:space:] [:upper:] [:xdigit:]


[:alpha:] = [a-zA-Z]

[:digit:] = [0-9]

[:lower:] = [a-z]

[:upper:] = [A-Z]

[:alnum:] = [a-zA-Z0-9]

[:space:] 单个空白字符

[:punct:] 所有标点符号

[:print:] 所有打印字符


你可能感兴趣的:(linux,字符串,通配符)