通配符

xiaoxiao2021-02-28  112

Shell 常用通配符:

字符含义*匹配 0 或多个字符?匹配任意一个字符[list]匹配 list 中的任意单一字符[!list] [^list]匹配 除list 中的任意单一字符以外的字符[c1-c2]匹配 c1-c2 中的任意单一字符 如:[0-9] [a-z]{string1,string2,…}匹配 string1 或 string2 (或更多)其一字符串{c1..c2}匹配 c1-c2 中全部字符 如{1..10}

例:

查找以 .txt 结尾的文件

$ ls *.txt

一次性创建10个文件 new_1_file.txt, new _2_file.txt …

$ touch new_{1..10}_file.txt

转载请注明原文地址: https://www.6miu.com/read-49035.html

最新回复(0)