Skip to content

Instantly share code, notes, and snippets.

@tamsanh
Created April 14, 2016 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamsanh/1fa3d92511f31cbfd4867132c1ced09a to your computer and use it in GitHub Desktop.
Save tamsanh/1fa3d92511f31cbfd4867132c1ced09a to your computer and use it in GitHub Desktop.
#!/bin/sh
for arg; do
realarg="$(realpath "$arg")"
case "$realarg" in
/|/usr|/var|/etc|/home|/bin|/lib|/lib64|/boot|/opt|/media|/root)
echo "refusing to remove $realarg" 1>&2
exit 100
;;
esac
done
exec /bin/rm --one-file-system --preserve-root "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment