Linux Shell Test

來源:互聯網
上載者:User

標籤:linux   字串   false   equivalent   

( EXPRESSION )

EXPRESSION is true          EXPRESSION為真


! EXPRESSION

EXPRESSION is false        EXPRESSION為假


EXPRESSION1 -a EXPRESSION2

both EXPRESSION1 and EXPRESSION2 are true      兩者都為真


EXPRESSION1 -o EXPRESSION2

either EXPRESSION1 or EXPRESSION2 is true      其中一個為真


-n STRING

the length of STRING is nonzero                字串長度非0


STRING equivalent to -n STRING


-z STRING

the length of STRING is zero                  字串長度為0


STRING1 = STRING2

the strings are equal                       字串相等


STRING1 != STRING2

the strings are not equal                    字串不相等


INTEGER1 -eq INTEGER2

INTEGER1 is equal to INTEGER2                 INTEGER1等於INTEGER2


INTEGER1 -ge INTEGER2

INTEGER1 is greater than or equal to INTEGER2      INTEGER1大於等於INTEGER2


INTEGER1 -gt INTEGER2

INTEGER1 is greater than INTEGER2              INTEGER1大於INTEGER2


INTEGER1 -le INTEGER2

INTEGER1 is less than or equal to INTEGER2        INTEGER1小於等於INTEGER2


INTEGER1 -lt INTEGER2

INTEGER1 is less than INTEGER2            INTEGER1小於INTEGER2


INTEGER1 -ne INTEGER2

INTEGER1 is not equal to INTEGER2              INTEGER1不等於INTEGER2


FILE1 -ef FILE2

FILE1 and FILE2 have the same device and inode numbers


FILE1 -nt FILE2

FILE1 is newer (modification date) than FILE2


FILE1 -ot FILE2

FILE1 is older than FILE2


-b FILE

FILE exists and is block special               檔案存在且為塊特殊檔案


-c FILE

FILE exists and is character special            檔案存在且為字元特殊檔案


-d FILE

FILE exists and is a directory                檔案存在且為目錄


-e FILE

FILE exists                            檔案存在


-f FILE

FILE exists and is a regular file              檔案存在且為正規檔案


-g FILE

FILE exists and is set-group-ID               檔案存在且已設定組ID


-G FILE

FILE exists and is owned by the effective group ID  檔案存在且屬組為有效組ID


-h FILE

FILE exists and is a symbolic link (same as -L)    檔案存在且為符號連結


-k FILE

FILE exists and has its sticky bit set          檔案存在且已設定sticky-bit許可權


-L FILE

FILE exists and is a symbolic link (same as -h)    檔案存在且為符號連結


-O FILE

FILE exists and is owned by the effective user   ID檔案存在且屬主為有效使用者ID


-p FILE

FILE exists and is a named pipe


-r FILE

FILE exists and read permission is granted      檔案存在且可讀


-s FILE

FILE exists and has a size greater than zero     檔案存在且大小非0


-S FILE

FILE exists and is a socket            檔案存在且是socket檔案


-t FD  file descriptor FD is opened on a terminal


-u FILE

FILE exists and its set-user-ID bit is set   檔案存在且已設定set-user-id bit許可權


-w FILE

FILE exists and write permission is granted            檔案存在且可寫


-x FILE

FILE exists and execute (or search) permission is granted   檔案存在且可執行


Linux Shell Test

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.