shell常见的通配符,注意与正则稍有不同:

字符 含义 实例
* 匹配0个或多个任意字符

a*b,a与b之间可以有任意长度的字符,也可以没有。

例如:aabcb,ab,azxcb...

? 匹配一个任意字符

a?b,a与b之间必须但也只能存在一个字符,该字符可以是任意字符。

例如:aab,abb,acb...

[list] 匹配list中的任意单个字符

a[xyz]b,a与b之间必须但也只能存在一个字符,该字符只能是x或y或z。

例如:axb,ayb,azb

[!list] 匹配除list中的任意单个字符

a[!a-z]b,a与b之间必须但也只能存在一个字符,该字符不能是小写字母。

例如:aAb,a0b...

[c1-c2] 匹配c1-c2间的任意单个字符

a[0-1]b,a与b之间必须但也只能存在一个字符,该字符只能是数字。

例如:a0b,a1b...

{string1,string2,...} 匹配string1、string2等中的一个字符串

a{abc,xyz,opq}b,a与b之间必须但也只能存在一个字符串,字符串只能是abc或xyz或opq。

例如:aabcb,axyzb,aopqb...

  实例:

[root@youxi1 ~]# ls /etc/*.conf
/etc/asound.conf /etc/kdump.conf /etc/man_db.conf /etc/sudo-ldap.conf
/etc/chrony.conf /etc/krb5.conf /etc/mke2fs.conf /etc/sysctl.conf
/etc/dracut.conf /etc/ld.so.conf /etc/nsswitch.conf /etc/vconsole.conf
/etc/e2fsck.conf /etc/libaudit.conf /etc/resolv.conf /etc/yum.conf
/etc/fuse.conf /etc/libuser.conf /etc/rsyslog.conf
/etc/GeoIP.conf /etc/locale.conf /etc/sestatus.conf
/etc/host.conf /etc/logrotate.conf /etc/sudo.conf
[root@youxi1 ~]# ls /etc/???.conf
/etc/yum.conf
[root@youxi1 ~]# touch file{1,2,3}
[root@youxi1 ~]# ls file*
file1 file2 file3
[root@youxi1 ~]# ls file[123]
file1 file2 file3

  

Shell中的通配符的更多相关文章

  1. shell 中的通配符:

    shell 中的通配符: *: 代表 0 个或者多个任意字符 ?: 代表一定有一个的任意字符 []: 代表一定有一个在括号内的字符(非任意字符).例如[abcd]代表一定有一个字符,可能是 abcd ...

  2. [Shell]正则表达式与通配符

    ----------------------------------------------------------------------------------------- 正则表达式与通配符: ...

  3. shell中(),[]和[[]]的区别

    1. 首先,尽管很相似,但是从概念上讲,二者是不同层次的东西."[[",是关键字,许多shell(如ash bsh)并不支持这种方式.ksh, bash(据说从2.02起引入对[[ ...

  4. shell中的大括号和小括号

      1.shell中的大括号和小括号   1.${var} 2.$(cmd) 3.() 和 {} 4.${var:-string}, ${var:+string},  ${var:=string}, ...

  5. shell中常用的特殊符号

    在shell中常用的特殊符号罗列如下: # ; ;; . , / \ 'string'| ! $ ${} $? $$ $* "string"* ** ? : ^ $# $@ `co ...

  6. Shell中特殊符号

    http://blog.chinaunix.net/u1/53027/showart.php?id=482234 在shell中常用的特殊符号罗列如下:# ;    ;;       .       ...

  7. Linux shell中的I/O重定向相关(转)

    1. 基本概念(这是理解后面的知识的前提,请务必理解)  a. I/O重定向通常与 FD有关,shell的FD通常为10个,即 0-9: b. 常用FD有3个,为0(stdin,标准输入).1(std ...

  8. Shell中bash的特性小结

    Shell: 用户与操作系统之间完成交互式操作的一个接口程序,为用户提供简化了的操作:上世纪的70年代中期在贝尔实验室,Bourne位Unix开发了一个shell程序Bourne Shell,简称sh ...

  9. shell 中test命令

    test可用于测试表达式,支持测试的范围包括:字符串比较,算术比较,文件存在性.属性.类型等判断.例如,判断文件是否为空.文件是否存在.是否是目录.变量是否大于5.字符串是否等于"longs ...

随机推荐

  1. Pthon魔术方法(Magic Methods)-可视化

    Pthon魔术方法(Magic Methods)-可视化 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.关于可视化的魔术方法简介 __str__: str()函数,format ...

  2. X2E车载数据记录仪

            随着智能驾驶及网联技术深入应用,汽车中传输的数据量与日俱增,包括多种总线数据.视频数据.雷达数据.定位数据等等.据悉,高级别智能驾驶汽车中每秒传输的总线数据就达到G比特级别.而从产品开 ...

  3. Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-D. Restore Permutation-构造+树状数组

    Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-D. Restore Permutation-构造+树状数组 [Pro ...

  4. CentOS7安装Postman

    1. 进入官网:https://www.getpostman.com/downloads/2. 点击下载3. 直接安装:tar zxvf ***.tar.gz4. 确认当前目录: pwd /home/ ...

  5. Oracle 中select XX_id_seq.nextval from dual 什么意思呢?

    说明 今天看别人的代码 ,遇见了 一条sql    select ctg_fault_list_id_seq.nextval from dual  不懂意思,然后就研究了下 dual :是oracle ...

  6. 界面交互~Toast和模态对话框

    界面交互 名称 功能说明 wx.showToast 显示消息提示框 wx.showModal 显示模态对话框 wx.showLoading 显示 loading 提示框 wx.showActionSh ...

  7. selenium获取元素信息方法(转载)

    1.获取当前页面的Url函数 方法:current_url 实例: driver.current_url 2.获取元素坐标 方法:location 解释:首先查找到你要获取元素的,然后调用locati ...

  8. CentOS6.5配置

    关闭防火墙 查看防火墙状态 /etc/init.d/iptables status 停止 /etc/init.d/iptables stop 开机不启动 chkconfig iptables off ...

  9. php curl模拟post请求的例子

    curl 在php中要模拟post请求数据提交我们会使用到curl函数,下面我来给大家举几个curl模拟post请求提交数据例子有需要的朋友可参考参考. 注意:curl函数在php中默认是不被支持的, ...

  10. springboot使用jdbcTemplate案例

    1 创建实体类 public class Student { private Integer stuid; private String stuname; public Integer getStui ...