Hacker News new | past | comments | ask | show | jobs | submit login

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...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: