Asterisk
Filename Substitution
The Asterisk
[root@server1 myfirstdir]# touch chapt{1,2,3,4,5,6}
[root@server1 myfirstdir]# ls
chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
The same substitution occurs if you use * with the echo command:
[root@server1 myfirstdir]# echo *
chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
[root@server1 myfirstdir]# echo * : *
chapt1 chapt2 chapt3 chapt4 chapt5 chapt6 : chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
[root@server1 myfirstdir]# touch a b c
[root@server1 myfirstdir]# ls
a b c chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
[root@server1 myfirstdir]# echo *t1
chapt1
[root@server1 myfirstdir]# echo *t*
chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
[root@server1 myfirstdir]# touch aa bb cc
[root@server1 myfirstdir]# touch aaa bbb ccc
[root@server1 myfirstdir]# touch abc bca cba
[root@server1 myfirstdir]# ls
a aa aaa abc b bb bbb bca c cba cc ccc chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
[root@server1 myfirstdir]# echo ?
a b c
[root@server1 myfirstdir]# echo ??
aa bb cc
[root@server1 myfirstdir]# echo ???
aaa abc bbb bca cba ccc
[root@server1 myfirstdir]# echo a?
aa
[root@server1 myfirstdir]# echo a??
aaa abc
[root@server1 myfirstdir]# echo ?*
a aa aaa abc b bb bbb bca c cba cc ccc chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
[root@server1 myfirstdir]# echo ??*
aa aaa abc bb bbb bca cba cc ccc chapt1 chapt2 chapt3 chapt4 chapt5 chapt6
Comments
Post a Comment