我知道我能做到这一点……
- if diff -q $f1 $f2
- then
- echo "they're the same"
- else
- echo "they're different"
- fi
但是,如果我想否定我正在检查的条件呢?即这样的事情(显然不起作用)
- if not diff -q $f1 $f2
- then
- echo "they're different"
- else
- echo "they're the same"
- fi
我可以这样做……
- diff -q $f1 $f2
- if [[ $? > 0 ]]
- then
- echo "they're different"
- else
- echo "they're the same"
- fi
- if ! diff -q $f1 $f2; then ...