From: Zefram <zefram@fysh.org>
To: "[Johan Sundstr_m]" <johsu650@student.liu.se>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: <n> == <n->?
Date: Tue, 4 Apr 2000 22:01:34 +0100 (BST) [thread overview]
Message-ID: <E12caS6-0000e6-00@crucigera.fysh.org> (raw)
In-Reply-To: <Pine.GSO.4.02.10004041813220.28633-100000@astmatix.ida.liu.se> from "[Johan Sundstr_m]" at "Apr 4, 2000 07:00:42 pm"
[Johan Sundstr_m] wrote:
>Sounds reasonable. After some digging through zshmisc(1), I'd guess the
>situation we're trying to protect from a possible ambiguity is "< word" --
>am I right?
Right right.
> I may be at a loss here, but I don't quite see where the
>problem might arise. Could someone depict an example or two and how to
>trigger the problem?
cat <123-456>foo
zsh treats this as a command line with two words, one of which is a glob
pattern that will match "00234foo" and so on. Bourne shell syntax has
this meaning the same as the way both zsh and sh interpret
cat <123-456 >foo
which is a command line with one word and two redirections (input from
"123-456", output to "foo"). It's quite common to omit spaces before
and after redirection operators.
>I noticed them being different (which showed better using cat than echo),
>but I failed to understand how the first case tried to operate; to me, it
>seemed like a broken effort at <<- or <<<, but then I guess I just didn't
>understand what happened, so my guess isn't worth a lot. :-]
What actually happens if you type "echo a<1" (before my patch) is that
the lexer sees a word "echo", then sees another word that starts with
"a". After the "<", it looks for a ">" to finish that glob operator;
it gets a newline, which is treated as part of the word, then it asks
for more input, still reading that word. Try typing "x>y" as the second
input line to complete the word.
Completely broken behaviour, nothing to do with here documents.
>Either way, I'm not sure I see the impact of this on the case where the
>word continues with a > and possibly more pattern matching. After all,
>when I want redirection, I don't try my luck at inserting a < or > in
>the middle of the current word I'm typing,
Quite. The practical rarity of the syntax clash is the only reason that
we can get away with that as a glob syntax. The reason for requiring the
"-" is to make the clash as small and as simply bounded as possible.
> and I haven't found anything in
>the man pages supporting that behaviour either.
It's not clear on where whitespace is permitted. Whitespace is allowed
but not required before and after redirection operators.
-zefram
prev parent reply other threads:[~2000-04-04 21:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-03 23:09 Johan Sundström
2000-04-04 1:16 ` Zefram
2000-04-04 17:00 ` Johan Sundström
2000-04-04 19:32 ` Peter Stephenson
2000-04-04 21:01 ` Zefram [this message]
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=E12caS6-0000e6-00@crucigera.fysh.org \
--to=zefram@fysh.org \
--cc=johsu650@student.liu.se \
--cc=zsh-workers@sunsite.auc.dk \
/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).