6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Linux | rm -f の役目は「確認を飛ばす」だけではない

Last updated at Posted at 2016-07-28

「存在しないファイルを削除しようとした時」に「エラーメッセージを出さない」という効能もある。

-f
Attempt to remove the files without prompting for confirmation, regardless of the file's permissions.
If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error.
The -f option overrides any previous -i options.

普通なら怒られるところでも。

$ rm not_exist_file
rm: not_exist_file: No such file or directory

-f なら何も言われない。

$ rm -f not_exist_file

参考

  • rm man

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

6
5
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?