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

Re: Any way to have ".sh" be optional?



On Thu, Sep 26, 2013 at 1:12 PM, TJ Luoma <luomat@xxxxxxxxx> wrote:

> So assume I have a script "mkseries.sh" which I do not want to rename
> but which I want to use in zsh just by typing "mkseries" -- is there a
> way to tell zsh "If I use the command 'foo' and there is no 'foo' but
> there is 'foo.sh' then I want to use 'foo.sh'?
>

command_not_found_handler() {
  local cmd=$1
  shift
  # apply whatever tests you want to figure out if $cmd.sh exists, return 1
if not
  # if it does exist, then
  $cmd.sh "$@"
}


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