shell中if 各引數含義

2021-06-21 05:26:12 字數 2050 閱讀 4485

shell中條件判斷if中的-z到-d的意思 2011-09-05 10:30

[ -a file ] 如果 file 存在則為真。

[ -b file ] 如果 file 存在且是乙個塊特殊檔案則為真。

[ -c file ] 如果 file 存在且是乙個字特殊檔案則為真。

[ -d file ] 如果 file 存在且是乙個目錄則為真。

[ -e file ] 如果 file 存在則為真。

[ -f file ] 如果 file 存在且是乙個普通檔案則為真。

[ -g file ] 如果 file 存在且已經設定了sgid則為真。

[ -h file ] 如果 file 存在且是乙個符號連線則為真。

[ -k file ] 如果 file 存在且已經設定了粘制位則為真。

[ -p file ] 如果 file 存在且是乙個名字管道(f如果o)則為真。

[ -r file ] 如果 file 存在且是可讀的則為真。

[ -s file ] 如果 file 存在且大小不為0則為真。

[ -t fd ] 如果檔案描述符 fd 開啟且指向乙個終端則為真。

[ -u file ] 如果 file 存在且設定了suid (set user id)則為真。

[ -w file ] 如果 file 如果 file 存在且是可寫的則為真。

[ -x file ] 如果 file 存在且是可執行的則為真。

[ -o file ] 如果 file 存在且屬有效使用者id則為真。

[ -g file ] 如果 file 存在且屬有效使用者組則為真。

[ -l file ] 如果 file 存在且是乙個符號連線則為真。

[ -n file ] 如果 file 存在 and has been mod如果ied since it was last read則為真。

[ -s file ] 如果 file 存在且是乙個套接字則為真。

[ file1 -nt file2 ] 如果 file1 has been changed more recently than file2, or 如果 file1 exists and file2 does not則為真。

[ 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.

cookie中各引數含義

xname 該cookie的名稱。一旦建立,該名稱便不可更改。value 該cookie的值。如果值為unicode字元,需要為字元編碼。如果值為二進位制資料,則需要使用base64編碼。domain 可以訪問該cookie的網域名稱。例如,如果設定為.zhihu.com,則所有以zhihu.com...

cookie中各引數含義

name 該cookie的名稱。一旦建立,該名稱便不可更改。value 該cookie的值。如果值為unicode字元,需要為字元編碼。如果值為二進位制資料,則需要使用base64編碼。domain 可以訪問該cookie的網域名稱。例如,如果設定為.zhihu.com,則所有以zhihu.com,...

PyInstaller各引數含義

通用引數引數名 描述說明 h顯示幫助無 v 顯示版本號 無 distpath 生成檔案放在 預設 當前目錄的dist資料夾內 workpath 生成過程中的中間檔案放在 預設 當前目錄的build資料夾內 y如果dist資料夾內已經存在生成檔案,則不詢問使用者,直接覆蓋 預設 詢問是否覆蓋 upx ...