News for hackers. Stuff that matters.
Re:Shellfirm: Intercept risky patterns at the command line by huksley on Sunday July 31, 2022 @09:13AM (#32295279)
One way to do it is to use your shell functions (or aliases) for example for bash:

  function rm() {
    if [[ "$@" =~ "-rf" && "${RISKY}" != "1" ]]; then
      echo "Confirm by running RISKY=1 rm $@"
    else
      command rm "$@"
    fi
  }
This goes into ~/.bashrc and I have a lot of commands customized to save time (for example git [1] or docker)

[1]: https://gist.github.com/huksley/ef70da85f8dc0c9ca6f8ec4f37c3...

There are no comments on this comment yet.