Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
how to search for a substring in a parameter?
- X-seq: zsh-users 5689
- From: Carlos Carvalho <carlos@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: how to search for a substring in a parameter?
- Date: Mon, 13 Jan 2003 16:13:04 -0200
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
I'm trying to see if the value of a parameter contains a given string
but didn't find an elegant way. All pattern matching substitutions
return only the non-matched portion of the value. There's a way to do
substitutions but not testing. I must be missing something. I'm using
if (( ${#foo//pattern/} < ${#foo} )); then
# contains pattern
else
# doesn't contain pattern
fi
Is there a better way?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author