Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Any way to have ".sh" be optional?
- X-seq: zsh-users 18010
- From: Jérémie Roquet <arkanosis@xxxxxxxxx>
- To: TJ Luoma <luomat@xxxxxxxxx>
- Subject: Re: Any way to have ".sh" be optional?
- Date: Thu, 26 Sep 2013 22:39:18 +0200
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=MFWrp5gxvrAtu1cA7+quRRDnAl4D1pLjeg5brVZFEfQ=; b=hedKi0709X0n46OYjmaX/QFImuEiwEhc2hv14DANwDT/4BXhYZpdGC3F+zqVu2DXFy gsPuO/OJcsHfpEIwRihS9/hIvxs8B+4lwCYVPotn+O4+07sh4+UiADKG1cYu7FT0+vio FeK3oFGCLSWfyPv4nIrmIhQp/WwsqcVrzY0DmCX/AHsHPgOqQm/yIqy/km6hfSA2V1Jg HaiDbvVNx1aKESU674fHfUmOuWsgx8Sw55QCiPsEq2Ai49smJd26wYjjbkFYeE9Li4Fl E0+q5kJlqiHeXHQeNIGSSOjQr9Ik8YVTmbyzPZ2AAv1AiRDpjVGG4ANjygCJRDMZDDHb 5qWQ==
- 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>
Hi,
2013/9/26 TJ Luoma <luomat@xxxxxxxxx>:
> The Subject line may not be the best description of what I want, but
> it was the best I could come up with.
>
> I tend to name all of my Zsh scripts to end with '.sh' so I can easily
> `fgrep -i Whatever *.sh` when I'm looking for something.
>
> However, I would rather not have to type the ".sh" if not necessary.
> (Yes, I am that lazy.)
>
> 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'?
Something like
command_not_found_handler() { test -x $1.sh && $1.sh $@[2,-1] }
should do the trick.
Best regards,
--
Jérémie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author