Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Intercepting commands before they're run



I've just been experimenting with the MH mail system to see if it will
do what I hope. In mush I can just type a message number to see a
message so I tried to think of a way to persuade zsh to do this.

The best I can do is:

preexec() {
  [[ $1 = <-> ]] && show $1
}

This works but zsh still tries to run the command so I always get
something like:
zsh: command not found: 3

Is there a way round this? If not, maybe we should let preexec return an
exit code to say the command should not be run - there may be other
uses. There might also be uses for preexec to be able to make changes to
the command-line before it is run.

Oliver Kiddle



Messages sorted by: Reverse Date, Date, Thread, Author