The multipart command alias on the left side in bash

I have a command (on Linux Bash) that I want to prevent so that I never work with a specific option. However, I still want to run this command with other parameters. So, for example, the following is in order:

command opt1
command opt2

But I want to disable

command badopt

I thought about it, imposing it on a nonexistent command in my profile, for example

alias "command badopt"=djskagldjkgldasg

but this does not seem to work. Any other suggestions (easy) to disable my ability to use this particular parameter while maintaining my ability to use other parameters?

+3
source share
2 answers
$ 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

+3
source

bash - , . , , , "foo":

foo () {
    case "$1" in 
        badopt) 
            echo "do not push this button again" >&2
            return 1
            ;;
    esac
    command foo "$@"
}

command , .

0