Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Any way to have ".sh" be optional?
- X-seq: zsh-users 18006
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: Re: Any way to have ".sh" be optional?
- Date: Thu, 26 Sep 2013 14:40:13 -0700
- In-reply-to: <CADjGqHsrd8K=rW6dyDxwddYMu-iG6tmNMMj0HtJZ6SVQksWmCw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADjGqHsrd8K=rW6dyDxwddYMu-iG6tmNMMj0HtJZ6SVQksWmCw@mail.gmail.com>
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