shell中條件判斷if中的 z到 d的意思

2021-06-09 19:27:44 字數 976 閱讀 9475

[ file1 -ot file2 ] 如果 file1 比 file2 要老, 或者 file2 存在且 file1 不存在則為真。 

[ file1 -ef file2 ] 如果 file1 和 file2 指向相同的裝置和節點號則為真。

[ -o optionname ] 如果 shell選項 「optionname」 開啟則為真。 

[ -z string ] 「string」 的長度為零則為真。 

[ -n string ] or [ string ] 「string」 的長度為非零 non-zero則為真。

[ string1 == string2 ] 如果2個字串相同。 「=」 may be used instead of 「==」 for strict posix compliance則為真。

[ string1 != string2 ] 如果字串不相等則為真。 

[ string1 < string2 ] 如果 「string1」 sorts before 「string2」 lexicographically in the current locale則為真。 

[ string1 > string2 ] 如果 「string1」 sorts after 「string2」 lexicographically in the current locale則為真。

[ arg1 op arg2 ] 「op」 is one of -eq, -ne, -lt, -le, -gt or -ge. 

these arithmetic binary operators return true if 「arg1」 is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to 「arg2」, respectively. 「arg1」 and 「arg2」 are integers.  

shell中條件判斷if中的 a到 z的意思

b file 如果file存在且是乙個塊特殊檔案則為真 c file 如果file存在且是乙個字特殊檔案則為真 d file 如果file檔案存在且是乙個目錄則為真 d前的 是邏輯非 例如 if d lcd path par date 表示後面的那個目錄不存在,則執行後面的then操作 e file...

shell中條件判斷if中的 z到 d選項

a file 如果 file 存在則為真。b file 如果 file 存在且是乙個塊特殊檔案則為真。c file 如果 file 存在且是乙個字特殊檔案則為真。d file 如果 file 存在且是乙個目錄則為真。e file 如果 file 存在則為真。f file 如果 file 存在且是乙個...

shell條件判斷if中的 a到 z的意思

a file 如果 file 存在則為真。b file 如果 file 存在且是乙個塊特殊檔案則為真。c file 如果 file 存在且是乙個字特殊檔案則為真。d file 如果 file 存在且是乙個目錄則為真。e file 如果 file 存在則為真。f file 如果 file 存在且是乙個...