From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14978 invoked from network); 13 Jan 2003 18:13:19 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Jan 2003 18:13:19 -0000 Received: (qmail 4438 invoked by alias); 13 Jan 2003 18:13:07 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5689 Received: (qmail 4431 invoked from network); 13 Jan 2003 18:13:07 -0000 From: Carlos Carvalho MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <15907.432.363150.443412@fisica.ufpr.br> Date: Mon, 13 Jan 2003 16:13:04 -0200 To: zsh-users@sunsite.dk Subject: how to search for a substring in a parameter? X-Mailer: VM 7.07 under Emacs 19.34.1 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?