一.文本比较
-nt (newer than)判断file1是否比file2新
-ot (older than)判断file1是否比file2旧
-ef 判断file1与file2 是否为同一个文件
eg: test file1 -nt file2
二.数值比较(比较两个整数)
-eq 两个数值相等(equal)
-ne 两个数值不相等(not equal)
-gt n1大于n2(greater than)
-lt n1小于n2(less than)
-ge n1大于等于n2(greater than or equal)
-le n1小于等于n2(less than or equal)
本文介绍了两种基本的比较方法:一种用于比较文件的新旧及是否为同一文件;另一种用于比较两个整数之间的大小关系,包括相等、不等、大于、小于及相应的等于情况。这些方法适用于多种编程场景。
1万+

被折叠的 条评论
为什么被折叠?



