I'd like to define a function that is called, whenever a shell-user types a command that does not exist. In my case I'd like to log the errors and try alternative commands.

currently, when typing e.g. dgfgsdjagfghsdg the error zsh: command not found: dgfgsdjagfghsdg is shown.

Is there a way to define a function, that get the typed command (+ arguments) as a parameter?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.