【发布时间】:2013-03-02 17:47:02
【问题描述】:
我该怎么做:
if !("abc" in file1 and "def" in file2)
then
echo "Failed"
fi
我已经知道如何检查 file1:grep -Fxq "abc" file1 中的“abc”,但我无法让 if not (command1 and command2) 部分工作。
【问题讨论】:
-
使用德摩根定律 - en.wikipedia.org/wiki/De_Morgan's_laws - 即“not(A and B)”变成“not A or not B”
-
谢谢,问题是我不知道怎么用 bash 脚本写...