Pattern: Deleting a system directory
Issue: -
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
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