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

Re: string starts with ...



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