📌  相关文章
📜  bash 检查文件中是否不存在字符串 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:37.800000             🧑  作者: Mango

代码示例1
Just use grep with flags 'F' (fixed string), 'x' (exact match) and 'q'
(quiet output) in order to check if a word string is in a file
if ! grep -Fxq "string" file.txt; then #do some code...#; fi