I have a command (in Linux Bash) that I want to prevent myself from ever running with a specific option. However, I want to still run that command with other options. So for example the following are OK:
command opt1
command opt2
But I want to disable
command badopt
I was thinking of doing this by aliasing it to a nonexistant command in my profile, like
alias "command badopt"=djskagldjkgldasg
but this doesn't seem to work. Any other suggestions for (easily) disabling my ability to use this specific option while preserving my ability to use other options?
$ cat >> $HOME/.bashrc
shutdown () {
if [ "x$1" = x-h ]; then
echo Please do not run shutdown with the -h option.
return
fi
/sbin/shutdown "$@"
}
# updated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With