From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 793 invoked from network); 3 Sep 2005 13:05:03 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Sep 2005 13:05:03 -0000 Received: (qmail 54218 invoked from network); 3 Sep 2005 13:04:57 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Sep 2005 13:04:57 -0000 Received: (qmail 18761 invoked by alias); 3 Sep 2005 13:04:50 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9378 Received: (qmail 18752 invoked from network); 3 Sep 2005 13:04:49 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 Sep 2005 13:04:49 -0000 Received: (qmail 53109 invoked from network); 3 Sep 2005 13:04:49 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by a.mx.sunsite.dk with SMTP; 3 Sep 2005 13:04:43 -0000 Received: (qmail 6967 invoked by uid 8); 3 Sep 2005 13:04:40 -0000 To: zsh-users@sunsite.dk Path: not-for-mail From: Geoff Wing X-Newsgroups: lists.zsh.users Subject: Re: trying to match yyyy-mm-dd what am I missing? Date: Sat, 3 Sep 2005 13:04:40 +0000 (UTC) Organization: PrimeNet Computer Consultants Message-ID: References: Reply-To: mason@primenet.com.au NNTP-Posting-Host: sparkles.primenet.com.au X-Trace: f.primenet.com.au 1125752680 13686 203.43.15.10 (3 Sep 2005 13:04:40 GMT) X-Complaints-To: usenet@f.primenet.com.au NNTP-Posting-Date: Sat, 3 Sep 2005 13:04:40 +0000 (UTC) User-Agent: slrn/0.9.8.1 (NetBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.0.4 Timothy Luoma typed: : I am trying to match all folders in the CWD which are in the format : YYYY-MM-DD. : if [ "$i" = 2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ] This gets expanded to all the directories matching it. See "CONDITIONAL EXPRESSIONS: .... Normal shell expansion is performed on the file, string and pattern arguments, but the result of each expansion is constrained to be a single word, similar to the effect of double quotes." You're trying to match each against (in your case with MARK_DIRS set) "2005-08-24/ 2005-08-26/ 2005-08-27/ 2005-08-28/ 2005-08-29/" Try a different solution, e.g.: for i in *(^M) do if [ -d "$i" ]; then case $i in 2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]) echo "YES: $i";; *) echo "no: $i" ;; esac fi done Regards, -- Geoff Wing