Skip to content
haruna edited this page May 20, 2021 · 4 revisions

Warning: deletes a system directory.

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:

If you do intend to delete a system directory, such as when working in a chroot or initramfs, you can disable this message with a directive:

# shellcheck disable=SC2114
rm -rf /usr 

Previous versions of shellcheck, up to and including 0.4.6, would ignore rm statements containing a -- (an arbitrary convention). This is no longer the case.

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