Override mkdir in bash / shell

alias, bash, shell, terminal, ubuntu

Solution

You can use the `command` built-in instead:

mkdir() {
  if [[ "$@" == *--parents* ]]; then
    command mkdir "$@"
  else
    command mkdir "$@" --parents
  fi
}

Problem

for more comfort I like to override mkdir like this: ``` mkdir() { if [[ "$@" == *--parents* ]]; then builtin mkdir "$@" else builtin mkdir "$@" --parents fi } ``` Unfortunately there is no builtin of mkdir. How can I do a workaround that does the job?

Original source