Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

The (X) flag.



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



Messages sorted by: Reverse Date, Date, Thread, Author