A detailed introduction to wildcards in Linux

巴扎黑
Release: 2017-09-02 12:00:10
Original
2122 people have browsed it

这篇文章主要介绍了Linux 中的通配符详解及实例的相关资料,希望通过本文能掌握Linux 通配符的知识,需要的朋友可以参考下

Linux 中的通配符详解及实例

一 通配符

 二 实战


[root@localhost ~]# mkdir dy
[root@localhost ~]# cd dy
[root@localhost dy]# touch dzp dzp2 dzp3 dzp34 dzpcang dzpbols
[root@localhost dy]# ls
dzp dzp2 dzp3 dzp34 dzpbols dzpcang
[root@localhost dy]# la dzp
bash: la: command not found...
[root@localhost dy]# ls dzp
dzp
[root@localhost dy]# ls dzp*
dzp dzp2 dzp3 dzp34 dzpbols dzpcang
[root@localhost dy]# ls dzp?
dzp2 dzp3
[root@localhost dy]# ls dzp[0-9]
dzp2 dzp3
[root@localhost dy]# ls dzp[0-9][0-9]
dzp34
[root@localhost dy]# ls dzp[^0-9]
ls: cannot access dzp[^0-9]: No such file or directory
[root@localhost dy]# touch dzpa
[root@localhost dy]# ls dzp[^0-9]
dzpa
[root@localhost dy]# ls dzp[^0-9]*
dzpa dzpbols dzpcang
Copy after login

三 Bash中的其他特殊符号

四 实战


[root@localhost dy]# echo ls
ls
[root@localhost dy]# echo dzp
dzp
[root@localhost dy]# aa=123
[root@localhost dy]# echo $aa
123
[root@localhost dy]# echo '$aa'
$aa
[root@localhost dy]# echo "$aa"
123
[root@localhost dy]# aa=ls
[root@localhost dy]# echo "$aa"
ls
[root@localhost dy]# aa=`ls`
[root@localhost dy]# echo "$aa"
dzp
dzp2
dzp3
dzp34
dzpa
dzpbols
dzpcang
[root@localhost dy]# bb=$(ls)
[root@localhost dy]# echo $bb
dzp dzp2 dzp3 dzp34 dzpa dzpbols dzpcang
[root@localhost dy]# echo $(date)
Sat Jul 15 17:23:31 CST 2017
[root@localhost dy]# echo \$bb
$bb
Copy after login

The above is the detailed content of A detailed introduction to wildcards in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!