Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
実行rm -r /var/some/dir/*してディレクトリが空の場合、エラーが返されます
rm -r /var/some/dir/*
このエラーを抑制して返されないようにするにはどうすればよいですか?
Linux bashスクリプトで使用します
stderr へのリダイレクトとは別に、以下も使用できます-f。
-f
rm -rf /var/some/dir/*
からman rm:
man rm
-f, --force ignore nonexistent files and arguments, never prompt
stderr をリダイレクトします。
rm -r /var/some/dir/* 2>/dev/null