Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 808 Bytes

SC2114.md

File metadata and controls

34 lines (21 loc) · 808 Bytes

Pattern: Deleting a system directory

Issue: -

Description

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.

Example of incorrect code:

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

Example of correct code:

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

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 

Further Reading