3 ms·
One way to do it is to use your shell functions (or aliases) for example for bash: function rm() { if [[ "$@" =~ "-rf" && "${RISKY}" != "1" ]]; then
by huksley 4y ago
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/ef70da85f8dc0c9ca6f8ec4f37c3a637 https://gist.github.com/huksley/ef70da85f8dc0c9ca6f8ec4f37c3...