find / -name "passwd" -print



find / -name passwd -print

有什么区别,谢谢

lihuc 回复于:2003-11-21 17:40:22
ding

race 回复于:2003-11-21 20:44:18
相同

nanaskylead 回复于:2003-11-21 21:18:08
没区别

sunnycn 回复于:2003-11-22 00:27:06
k 看看结果,自己再想想。

laoxia 回复于:2003-11-22 09:28:46
find -name "p assswd" -print ( 注意文档名有一空格)
find -name p asswd -print (不用括号就会报错)

laoxia 回复于:2003-11-22 09:55:59
在UNIX的SHELL里,有一些特别的字符,如

! match all string except those matched by the pattern-list ( 任何匹配
以外的字符串)
* match zero or more occurence of the pattern-list ( 出现0或多次)
? match zero or once occurence of pattern-list ( 出现0或一次)
@ match exactly once occurence of pattern-list ( 只出现一次)
match one or more occurence of pattern-list ( 出现一次或多次)

Example:

[color=red:0840de741f]!(David | Pitts)[/color:0840de741f] 任何不含David和Pitts的字符串都符合条件

[color=red:0840de741f]@(David & Pitts )[/color:0840de741f] David和Pitts 都要出现一次才符合条件(注意,只是一次)

[color=red:0840de741f]Den*(nis | nie | ny )[/color:0840de741f] Den, Dennis,Dennie,Denny都符合条件

[color=red:0840de741f]Den (nis | nie | ny )[/color:0840de741f] Dennis, Dennie, Denny 都符合条件

[color=red:0840de741f]Den?(nis | nie | ny )123[/color:0840de741f] Den123,Dennis123,Dennie123,Denny123都符合条件


而单引号,就是消除任何特别字符如#,$,@等等的特别含义

双引号,除了”,$,\,、外,消除任何其他特别字符的含义,所以双引号比单引
号功能弱一些

more ' $a' 能够看文档名为$a的文档

more $a 将把$a看成一个变量,将报错(假如$a恰巧是个文档名,则能够执行)

beginner-bj 回复于:2003-11-22 12:20:33
怎么一回事?
[code:1:783969a43e]bash-2.03$ cat >s
David
Pitts
David,Pitts
Den
Dennis
Dennie
Denny
Dennis, Dennie, Denny
Den123
Dennis123
Dennie123
Denny123
bash-2.03$ cat s |grep !(David | Pitts)
bash: !: event not found
bash-2.03$ cat s |grep !(David | Pitts)
bash: !: event not found
bash-2.03$ cat s |grep @(David & Pitts )
bash: syntax error near unexpected token `@(D'
bash-2.03$ cat s |grep @ (David & Pitts )
bash: syntax error near unexpected token `(D'
bash-2.03$ cat s |grep Den*(nis | nie | ny )
bash: syntax error near unexpected token `Den*(n'
bash-2.03$[/code:1:783969a43e]

beginner-bj 回复于:2003-11-24 10:23:13
更有人验证过吗?

hardiwang 回复于:2003-11-24 10:59:15
和您的效果相同!
到底怎么回事呢?

Hunk 回复于:2004-03-12 15:51:38
不加引号在cshell里面会出错。