Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: string starts with ...
- X-seq: zsh-users 9845
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: string starts with ...
- Date: Mon, 23 Jan 2006 10:45:10 +0000
- In-reply-to: <1060121170201.ZM20033@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20060121135331.GA557@xxxxxxxxxxxxxxxxxxxxx> <87oe254qx8.fsf@xxxxxxxxxxxxxxxx> <1060121170201.ZM20033@xxxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer wrote:
> This works, too, by forcing the '#' to be treated as part of a pattern:
>
> [[ $YOURSTRING == (#)* ]]
You mean with extendedglob turned off.
I tried it with extendedglob turned on (this is for aficionados only):
% [[ 'foo' = (#)foo ]] && echo yes
yes
It looks like it's valid to have zero globbing flags. The manual
doesn't actually say this in as many words, but it's sort of useful:
% typeset approx
% [[ foo = (#$approx)fo ]] && echo yes
% approx=a1
% [[ foo = (#$approx)fo ]] && echo yes
yes
Note no globsubst trickery needed: $approx can be a straight string as
long as the # is unquoted. This probably needs documenting. However,
I think all globbing flags can be turned off by other flags, so having
none isn't actually that useful.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.html
Messages sorted by:
Reverse Date,
Date,
Thread,
Author