Linux — ハイフンで始まるファイルを削除する
解決
ダブルダッシュの後に消したいファイル名を書く。
rm -- -file.txt
意味
ダブルダッシュ ( --
) はコマンドフラグの終わりを表すらしい。
The double dash “–” means “end of command line flags
問題
-file.txt
がコマンドオプションと認識されてしまい、消せなかった。
$ rm -file.txt
rm: illegal option -- l
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
エスケープも不可。
$ rm '\-file.txt'
rm: \-file.txt: No such file or directory
Author And Source
この問題について(Linux — ハイフンで始まるファイルを削除する), 我々は、より多くの情報をここで見つけました https://qiita.com/YumaInaura/items/4714542928219ccf15cf著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .