我对 Linux 很陌生,不懂编程。但是通过阅读一些我可以理解的东西,我可以提问。
我正在做类似下面的事情,
在一个文件中找到几个单词并在另一个文件中采取相应的行动。
find in log.txt
if "not found" 1 > notify.txt
if "reset by peer" 2 > notify.txt
if "Permission denied" 3 > notify.txt
if "Fetching" 0 > notify.txt
exit
喜欢
if [it found] "not found" [text in the log.txt then it will write] 1 > notify.txt
if [it found] "reset by peer" [text in the log.txt then it will write] 2 > notify.txt
if [it found] "Permission denied" [text in the log.txt then it will write] 3 > notify.txt
if [it found] "Fetching" [text in the log.txt then it will write] 0 > notify.txt
请帮我写剧本。
我想在 notify.txt 中写 0 或 1 或 2 或 3。现在脚本将决定写什么。脚本将通过读取 log.txt 文件来决定。
谢谢