zsh-users
 help / color / mirror / code / Atom feed
From: "Jérémie Roquet" <arkanosis@gmail.com>
To: TJ Luoma <luomat@gmail.com>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: Any way to have ".sh" be optional?
Date: Thu, 26 Sep 2013 22:39:18 +0200	[thread overview]
Message-ID: <CAFOazAPjm-gLDjd5yrvJpzGNu+pfJ_vygsDfYwro+xcKTGj2Yg@mail.gmail.com> (raw)
In-Reply-To: <CADjGqHsrd8K=rW6dyDxwddYMu-iG6tmNMMj0HtJZ6SVQksWmCw@mail.gmail.com>

Hi,

2013/9/26 TJ Luoma <luomat@gmail.com>:
> 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


  reply	other threads:[~2013-09-26 23:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 20:12 TJ Luoma
2013-09-26 20:39 ` Jérémie Roquet [this message]
2013-09-26 21:27 ` Micah Elliott
2013-09-26 23:35   ` TJ Luoma
2013-09-26 21:40 ` Bart Schaefer
2013-09-26 23:18 ` TJ Luoma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFOazAPjm-gLDjd5yrvJpzGNu+pfJ_vygsDfYwro+xcKTGj2Yg@mail.gmail.com \
    --to=arkanosis@gmail.com \
    --cc=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).