* The (X) flag.
@ 2006-06-28 4:57 Frank Terbeck
2006-06-28 6:51 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Frank Terbeck @ 2006-06-28 4:57 UTC (permalink / raw)
To: zsh users
Hi List.
Quoting the manual:
[snip]
X With this flag parsing errors occurring with the Q and e flags
or the pattern matching forms such as `${name#pattern}' are
reported. Without the flag they are silently ignored.
[snap]
Now I thought it might throw an error when a given pattern doesn't
match:
[snip]
zsh% foo='Hello World, mere mortal!'
zsh% print ${foo#*, }
mere mortal!
zsh% print ${foo#*. }
Hello World, mere mortal!
zsh% print ${(X)foo#*. }
Hello World, mere mortal!
[snap]
I would have expected an error for the last command.
However, I guess, I'm misunderstanding the manual. So, could someone
please give an example of what this flag does?
Regards, Frank
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: The (X) flag.
2006-06-28 4:57 The (X) flag Frank Terbeck
@ 2006-06-28 6:51 ` Bart Schaefer
2006-06-28 7:04 ` Frank Terbeck
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2006-06-28 6:51 UTC (permalink / raw)
To: zsh users
On Jun 28, 6:57am, Frank Terbeck wrote:
}
} Now I thought it might throw an error when a given pattern doesn't
} match:
No. Failing to match the pattern is not an error, it's one of the
expected possible outcomes.
} However, I guess, I'm misunderstanding the manual. So, could someone
} please give an example of what this flag does?
The errors involved are lexical errors, that is, failures in tokenizing
the string. I can't immediately think of one that affects ${var#pat},
but here's an obvious one with the (Q) flag:
% foo="two ' matched ' quotes"
% print ${(Q)foo}
two matched quotes
% foo="only one ' quote"
% print ${(Q)foo}
only one ' quote
% print ${(XQ)foo}
zsh: unmatched '
%
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: The (X) flag.
2006-06-28 6:51 ` Bart Schaefer
@ 2006-06-28 7:04 ` Frank Terbeck
0 siblings, 0 replies; 3+ messages in thread
From: Frank Terbeck @ 2006-06-28 7:04 UTC (permalink / raw)
To: zsh users
Bart Schaefer <schaefer@brasslantern.com>:
> On Jun 28, 6:57am, Frank Terbeck wrote:
> }
> } Now I thought it might throw an error when a given pattern doesn't
> } match:
>
> No. Failing to match the pattern is not an error, it's one of the
> expected possible outcomes.
>
> } However, I guess, I'm misunderstanding the manual. So, could someone
> } please give an example of what this flag does?
>
> The errors involved are lexical errors, that is, failures in tokenizing
> the string. I can't immediately think of one that affects ${var#pat},
> but here's an obvious one with the (Q) flag:
[...]
Okay, that makes it a lot clearer for me.
Thank you.
Regards, Frank
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-06-28 7:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-28 4:57 The (X) flag Frank Terbeck
2006-06-28 6:51 ` Bart Schaefer
2006-06-28 7:04 ` Frank Terbeck
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).