From: Ben Klein <robobenklein@gmail.com>
To: Perry Smith <pedz@easesoftware.com>
Cc: zsh-users <zsh-users@zsh.org>
Subject: Re: Change interactive command into a comment
Date: Wed, 13 Nov 2019 20:15:26 -0500 [thread overview]
Message-ID: <CAC8p+dVb4Q0Bv9Keh13O_tJtzw-G9NxBd+iCdxXrEQ8ay=MP8w@mail.gmail.com> (raw)
In-Reply-To: <AE14DF7F-5C34-4D14-A20A-8356C547E114@easesoftware.com>
[-- Attachment #1: Type: text/plain, Size: 1902 bytes --]
The answer to that (assuming extended_glob) is way at the bottom of the
Expansion docs:
http://zsh.sourceforge.net/Doc/Release/Expansion.html#Filename-Generation
To quote directly:
x#
(Requires EXTENDED_GLOB to be set.) Matches zero or more occurrences of the
pattern x. This operator has high precedence; ‘12#’ is equivalent to
‘1(2#)’, rather than ‘(12)#’. It is an error for an unquoted ‘#’ to follow
something which cannot be repeated; this includes an empty string, a
pattern already followed by ‘##’, or parentheses when part of a KSH_GLOB
pattern (for example, ‘!(foo)#’ is invalid and must be replaced by
‘*(!(foo))’).
x##
(Requires EXTENDED_GLOB to be set.) Matches one or more occurrences of the
pattern x. This operator has high precedence; ‘12##’ is equivalent to
‘1(2##)’, rather than ‘(12)##’. No more than two active ‘#’ characters may
appear together. (Note the potential clash with glob qualifiers in the form
‘1(2##)’ which should therefore be avoided.)
*\Ben Klein*
About: https://unhexium.net/about/
Other places online: https://unhexium.net/ll/
Contact me securely: https://keybase.io/robobenklein
On Wed, Nov 13, 2019 at 7:25 PM Perry Smith <pedz@easesoftware.com> wrote:
> With bash, I got into the following habit. If I started typing a long
> command and then decided I didn’t want to execute it right now for some
> reason, I would hit control-A to get back to the start of the line and then
> add a # in front and hit return.
>
> This would put the command into history and so later I could recall it,
> remove the #, and execute the command.
>
> With zsh, when I add the # to the front and hit return I get:
>
> zsh: bad pattern: #
>
> I found INTERACTIVE_COMMENTS but now I’m curious, what is zsh trying to do
> with a line starting with # ? e.g. # echo dog
>
>
next prev parent reply other threads:[~2019-11-14 1:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 18:34 Perry Smith
2019-11-14 1:15 ` Ben Klein [this message]
2019-11-14 4:41 ` Danh Doan
2019-11-14 13:19 ` Perry Smith
2019-11-14 15:40 ` Daniel Shahaf
2019-11-14 15:56 ` Danh Doan
2019-11-14 22:21 ` Oliver Kiddle
2019-11-15 12:09 ` zzapper
2019-11-15 13:15 ` Perry Smith
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='CAC8p+dVb4Q0Bv9Keh13O_tJtzw-G9NxBd+iCdxXrEQ8ay=MP8w@mail.gmail.com' \
--to=robobenklein@gmail.com \
--cc=pedz@easesoftware.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).