歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> SHELL編程 >> Shell Test命令參數解析

Shell Test命令參數解析

日期:2017/2/28 15:57:57   编辑:SHELL編程

Test命令參數解析 .

test -n string : string 不為空

test -z string : string 為空

test int1 -eq int2 : int1 == int 2

test int1 -ne int2 : int1 != int2

test int1 -gt int2 : int1 > int2

test int1 -ge int2 : int1 >= int2

test int1 -lt int2 : int1 < int2

test int1 -le int2 : int1 <= int2

test -r filename : 用戶對文件filename有讀權限

test -w filename : 用戶對文件filename有寫權限

test -x filename : 用戶對文件filename有可執行權限

test -f filename : 文件filename為普通文件

test -d filename : 文件filename為目錄

test -c filename : 文件filename為字符設備文件

test -b filename :文件filename為塊設備文件

test -s filename : 文件filename大小不為零

test -t fnumb : 與文件描述符fnumb(默認值為1)相關的設備是一個終端設備

test ! -s empty : empty 為空

test -a : And

test -o : Or

Copyright © Linux教程網 All Rights Reserved