Skip to content
koalaman edited this page Jan 25, 2015 · 4 revisions

Warning: deletes a system directory. Use 'rm --' to disable this message.

Problematic code:

rm -rf /usr /lib/nvidia-current/xorg/xorg

Correct code:

rm -rf /usr/lib/nvidia-current/xorg/xorg

Rationale:

The example line of code was an actual bug in the Bumblebee NVIDIA driver.

Due to an accidental space, it deleted /usr instead of just the particular directory.

Exceptions:

In cases of chroot, initramfs and similar, it's reasonable to delete otherwise important directories. Due to this, Shellcheck will not warn if the command contains --:

rm -rf -- /usr

This is an arbitrary convention to allow deleting such directories without having to use a directive to silence the warning.

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally