建设网站证书查询,网站建设免责声明,自考网页制作与网站建设,高端网站建设公司怎么选grep [options]…… pattern [file]…… 工作方式#xff1a; grep 在一个或者多个文件中搜索字符串模板#xff0c;如果模板中包括空格#xff0c;需要使用引号引起来#xff0c;模 板后的所有字符串会被看作是文件名。 工作结果#xff1a;如果模板搜索成功#xf… grep [options]…… pattern [file]…… 工作方式 grep 在一个或者多个文件中搜索字符串模板如果模板中包括空格需要使用引号引起来模 板后的所有字符串会被看作是文件名。 工作结果如果模板搜索成功则返回 0 状态码如果搜索不成功则返回 1 状态码如果搜索的文件不存 在则返回 2 的状态码。我们可以利用这些返回状态码进行一些自动化的 shell 脚本处理工作。 [rootshell shell] # grep root /etc/ssh/sshd_config #ChrootDirectory none [rootshell shell] # grep -i root /etc/ssh/sshd_config PermitRootLogin yes # the setting of PermitRootLogin without-password. #ChrootDirectory none [rootshell shell] # grep -ni root /etc/ssh/sshd_config 46 :PermitRootLogin yes 98 : # the setting of PermitRootLogin without-password. 128 : #ChrootDirectory none [rootshell shell] # grep -w bin /etc/passwd [rootshell shell] # grep -v a /etc/passwd