shell腳本中 if 判斷時候-s是什么意思


-s file     文件大小非0時為真
[ -f "somefile" ] :判斷是否是一個文件

[ -x "/bin/ls" ] :判斷/bin/ls是否存在並有可執行權限

[ -n "$var" ] :判斷$var變量是否有值

[ "$a" = "$b" ] :判斷$a和$b是否相等 

-r file     用戶可讀為真

-w file     用戶可寫為真

-x file     用戶可執行為真

-f file     文件為正規文件為真

-d file     文件為目錄為真

-c file     文件為字符特殊文件為真

-b file     文件為塊特殊文件為真

-s file     文件大小非0時為真    -s file true if the file has nonzero size

-t file     當文件描述符(默認為1)指定的設備為終端時為真

 

-a file exists.
-b file exists and is a block special file.
-c file exists and is a character special file.
-d file exists and is a directory.
-e file exists (just the same as -a).
-f file exists and is a regular file.
-g file exists and has its setgid(2) bit set.
-G file exists and has the same group ID as this process.
-k file exists and has its sticky bit set.
-L file exists and is a symbolic link.
-n string length is not zero.
-o Named option is set on.
-O file exists and is owned by the user ID of this process.
-p file exists and is a first in, first out (FIFO) special file or
named pipe.
-r file exists and is readable by the current process.
-s file exists and has a size greater than zero.
-S file exists and is a socket.
-t file descriptor number fildes is open and associated with a
terminal device.
-u file exists and has its setuid(2) bit set.
-w file exists and is writable by the current process.
-x file exists and is executable by the current process.
-z string length is zero.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM