Override command with parameters (rm) in bash

Viewed 17

Good evening people, I'd like to make sudo rm -r * run the following command

echo -n 'Are you abso-fucking-lutely sure you wanna delete everything inside '
echo -n $(pwd)
read -r -p '? ' choice
choice=${choice,,}
if [[ $choice =~ ^(y| ) ]]; 
    then sudo rm -r *;
fi

because I got into quite a bit of trouble as i used rm -r * in ~... (yes, i know i know, i shouldn't do rm -r * but i kinda got used to doing stupid things like this..)

Is there any way to replace the rm command but only if it's fed the arguments -r and *? Alias doesn't seem to do the trick (and i'm quite new to the bash stuff so please excuse me for asking a potentially stupid question) Thank you all for your time and have a good day :)

0 Answers
Related