在
Linux机器上,我想检查是否存在特定的套接字文件.我知道套接字文件存在,但我在bash中的检查没有向我显示:
- $ls -l /var/run/supervisor.sock
- srwxrw-rw- 1 root root 0 Jun 3 13:30 /var/run/supervisor.sock # <== THE FILE EXISTS!!
- $if [ ! -f /var/run/supervisor.sock ]; then echo 'file does not exist!'; fi
- file does not exist!
为什么哦为什么不能bash看到该文件存在?
解决方法
http://www.tldp.org/LDP/abs/html/fto.html
见男人1测试:
- -e FILE
- FILE exists
- -f FILE
- FILE exists and is a regular file
- ...
- ...
- -S FILE
- FILE exists and is a socket