linux下刪除帶'-'的文件

不知爲什麼主目錄下忽然多了個-sV文件,目測是由於nmap的-sV參數產生的。
寫下來權當作個筆記~shell

如今來模擬下當時的狀況code

touch -- -sV
touch ./-sV # 兩種都行

如今工做目錄底下會產生一個文件名爲-sV的文件
若是執行orm

rm -sV

會產生一個錯誤rem

rm: invalid option -- 's'
Try 'rm --help' for more information.

緣由是無效的參數sit

原本打算Google下看看的,結果rm --help就看到答案了io

To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
  rm -- -foo

  rm ./-foo
相關文章
相關標籤/搜索