|
发表于 2009-12-25 16:13:57
|
显示全部楼层
$id是变量,"`cat $home/.ssh/identity.pub`" ,应该是cat $home/.ssh/identity.pub显示的内容
$file是一个变量,指的是$home/.ssh/authorized_keys
"^$id$"里的^是行开头,$表示行结尾。如"^file$"则匹配只有字符串file的行。这里$id也会进行相应的变量替换,替换为之前的"`cat $home/.ssh/identity.pub`" 的内容。
再举个例子:
grep "^string$" file 表示显示文件file里匹配行内只有字符串string的行。
如果 grep "^$id$" $file >/dev/null 2>&1 返回值,则为真,否则为假
!为取反。 |
|