diff --git a/rootfs/usr/share/parchlinux/zsh/functions/saferm.zsh b/rootfs/usr/share/parchlinux/zsh/functions/saferm.zsh new file mode 100644 index 0000000..fe105c2 --- /dev/null +++ b/rootfs/usr/share/parchlinux/zsh/functions/saferm.zsh @@ -0,0 +1,14 @@ +safe_rm() { + if [[ "$*" =~ (^| )/($| ) ]]; then + echo "Error: Attempt to use 'rm' on root (/) is blocked for your safety!" + return 1 + elif [[ "$*" =~ "--no-preserve-root" ]]; then + echo "Error: '--no-preserve-root' usage is blocked for your safety!" + return 1 + fi + + command rm "$@" +} + +alias rm="safe_rm" +