Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell脚本:用于通配符的Grep命令_Shell - Fatal编程技术网

Shell脚本:用于通配符的Grep命令

Shell脚本:用于通配符的Grep命令,shell,Shell,有谁能告诉我如何在下面grep行,因为当我尝试grep它时,它给出了错误的结果 */5 * * * * /home/file.sh" 您可以使用grep-F(固定字符串): 您想要什么grep?您尝试了什么?定义“错误结果”以及“预期结果”。在crontab中,如果存在“*/5****/home/file.sh”,则我无需添加此项。但当我尝试grep这一个并比较它时,它显示条目不存在,并且再次添加到那里。如果我运行我的脚本10次,那么这10次将添加到crontabeaser中,即100个单词,

有谁能告诉我如何在下面grep行,因为当我尝试grep它时,它给出了错误的结果

*/5 * * * * /home/file.sh"

您可以使用
grep-F
(固定字符串):


您想要什么
grep
?您尝试了什么?定义“错误结果”以及“预期结果”。在crontab中,如果存在“*/5****/home/file.sh”,则我无需添加此项。但当我尝试grep这一个并比较它时,它显示条目不存在,并且再次添加到那里。如果我运行我的脚本10次,那么这10次将添加到crontabeaser中,即100个单词,显示您的脚本您尝试了什么。。。
grep -F '*/5 * * * * /home/file.sh' cron.txt
*/5 * * * * /home/file.sh