Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. {"title":"Shell if 参数笔记","type":"blogGist","show":true,"description":"Shell if 参数笔记","tag":["shell"]}
  2.  
  3. 文件:
  4.  
  5. * -b 当 file 存在并且是 块文件时, 返回 true
  6. * -c 当 file 存在并且是 字符文件时, 返回 true
  7. * **-d 当 file 存在并且是 目录时, 返回 true**
  8. * **-e 当 file 存在时, 返回 true**
  9. * **-f 当 file 存在并且是 普通文件时, 返回 true**
  10. * -g 当 file 存在,并且设置了 SGID 时, 返回 true (SGID 是 Set Group ID 的意思)
  11. * -h 当 file 存在, 并且是一个 符号链接文件时, 返回 true
  12. * i
  13. * -k 当 file 存在, 并且设置了sticky
  14. * **-L 当 file 存在, 并且是一个符号连接时, 返回 true**
  15.  
  16. * **-x 当file 存在,并且具有可执行权限**
  17. * -S 当 file 存在, 并且是一个 socket 文件, 返回 true
  18.  
  19.  
  20. 比较:
  21. * -n 非空时, 返回 true
  22. * -z 为空时, 返回 true
  23.  
  24.  
  25. ```shell
  26. if [ -n "" ] ; then
  27. echo 1
  28. fi
  29. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement