2011-07-28 24 views
7

我看到了test的手冊頁。什麼是unix上的常規文件

其中提到以下內容。

-e pathname 
    True if pathname resolves to a file that exists. False if pathname cannot be resolved. 
-f pathname 
    True if pathname resolves to a file that exists and is a regular file. False if pathname cannot be resolved, or if pathname resolves to a file that exists but is not a regular file. 

-f標誌說 真,如果路徑解析到一個真實存在的文件,是一個普通文件 有誰請告訴什麼是一個普通的文件,究竟是不是一個普通的文件。

回答

4

非常規文件是設備,管道,套接字...例如,請嘗試[ -f /dev/tty0 ]。符號鏈接也是非常規的,但他們解決test -f

2

它不是一個目錄,設備文件,塊設備,FIFO或套接字。如果你做了ls -l。以「 - 」開頭的是文件。其實大多數人只是將其稱爲文件。

相關問題